I made some adjustment in the code and my final code looks like below-
app.alert("An Error Occured while Exporting the File Attachment: " + cName + "\n\n" + e);
With the above code, I can attach file successfully. But my problem is that when I want to open file attachment in Acrobat Pro XI, it is showing below error instead of opening the file. This error is showing independent of file attachment type (I tried attaching doc, txt and pdf file).
BeIow is the screenshot link of security of acrobat Pro XI.
My file GPD is a .doc file. I checked the code in Acrobat Pro DC and attachments are opening without any problem. Now I am using below code so that acrobat pro XI user can open file by selecting from navigation panel.
The script is fine, the problem at you end seems to be the attached file itself. Acrobat exports only a handful of file types (PDF, JPG, PNG …), all others a blocked for security reasons, so noone simply could run an evil executable attached to a PDF. You screenshot states that your file "GPD" doesn't have any file extensions, so Acrobat of course blocks it.