Expand my Community achievements bar.

How to upload a file that stored on a web server

Avatar

Level 1

I read in one of the posts that there are two ways to upload / attach a PDF file to a PDF form. The conventional way of allowing the end user to browse their hard drive and attach a file and submit the attached file with the FDF form data, and the secondary approach in which the end user links to a file residing on a Web server and then submits the form data. I was hoping there are some sample scripts that illustrates the second approach of linking to a document residing on a Web server for file upload via a PDF form.

Here is the original post: https://forums.adobe.com/thread/341433

5 Replies

Avatar

Level 10

Are you wanting to have a field on the form were the form filler can enter a URL to a file?

Avatar

Level 1

Yes. Maybe I misunderstood the previous post but it sounds like by entering the URL to the file residing on the server the file would be attached to the form when submitted.

Here is the original post: https://forums.adobe.com/thread/341433

Avatar

Level 10

That was not how I read the thread, and the sample, which is on page 8 or somewhere down the chain doesn't do that.  There is a http get method available, maybe you could use that.  But it would depend on the file type.  I have tried with image files and never got it to work, there seemed to be a problem with handling null characters in a file, but a text, html, xml, json file would probably be ok.

Avatar

Level 1

Thanks for your help with this. Do you think the http get method will work if the remote file is a PDF? If so, are you aware of any examples I can look at?

Avatar

Level 1

Thanks again for your help. I guess the real issue I'm trying to solve for is uploading a PDF file to URL and getting a success message return i.e. ("resultCode=SUCCESS&fileAuthToken=65922027422002491920600182984091022955832")

My goal is to emulate the simple form upload that illustrated below in HTML.

<html>

<form enctype="multipart/form-data" action="https://printonline.fedex.com/latest/PartnerUploadServlet?authToken=65912831655071066317502261219660..." method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="100000" />

Choose a file to upload: <input name="uploadedfile" type="file" /><br />

<input type="submit" value="Upload File" />

</form>

</html>

When I use the HTTP submit button to send the form to the target URL it returns a message that states: ("resultCode=FAILED&errorMessage=Attempt+to+Upload+0+files")

When I used the standard button configured to submit the form as a PDF file I get no response from the target server. Any idea on which direction I should go to accomplish this task?