Say I have an html page with a form for posting. The form is intended to post a file to my server, and to this end currently uses a <input type="file" name="attachment" ...>
tag to attach this file data. However, what if I want to programmatically attach this file data instead of manually browsing on my local machine?
Say for instance I have the raw file data in text format for a file and I want to attach that to the form. I've tried things along the lines of
<input type="hidden" name="attachment" value=myRawFileData ...>
However when an <input type="file">
is submitted with the form there are two attributes filename
and Content-Type
that show up in the post, and when I use the method mentioned above the only attribute that appears is the name="attachment"
one. So I'm assuming these are specific to the whatever html File object is being attached through the type="file" attribute. Is there a way to attach a hmtl "file object" without using type="file"
and browsing on the local machine?