Print Page | Close Window

Script to Browse and Add an Attachment

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 29 Jan 2020 at 6:43am
Software Version: Web Wiz Forums 11.10 -

Topic: Script to Browse and Add an Attachment
Posted By: mhoney
Subject: Script to Browse and Add an Attachment
Date Posted: 11 Apr 2014 at 7:21am

Hoping you might be able to be so kind as to suggest some script that allows a user to click a button, browse for a file and add it as an attachment.

I have an example that requires a user to put in the file name and path in some fields, but I don't know how to browse for a file without a user having to input this information (makes it easier for them).

Thanks for your help.Smile



Posted By: try67
Date Posted: 11 Apr 2014 at 9:34am
This code will prompt the user to select a file and will then attach that file to the PDF, under the given name ("Attachment1", in this case):

this.importDataObject({cName: "Attachment1"});

- Acrobat Expert - Contact me personally at
Check out my custom-made scripts website:

Posted By: mhoney
Date Posted: 12 Apr 2014 at 4:40am
Thanks for your help that is exactly what I need.



Posted By: Ragu
Date Posted: 06 Feb 2015 at 6:58pm
That was very helpful, now I know how to add a attachment button to PDF.
Could you please let me know what I can do to attach multiple files.
I could attach multiple files by clicking but they are not being saved.
Only the last attached file is saved

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -