urir10
asked on
Pass file from input type "File" to another page using Javascript
Hi All
I have a page that has some input fields and a file upload field (html Input Type="File", not asp FileUpload)
When the button is submitted it passes all the values to another page that writes it to the DB.
The only problem is to upload the file, how can i pass the file to the other page?
I have a page that has some input fields and a file upload field (html Input Type="File", not asp FileUpload)
When the button is submitted it passes all the values to another page that writes it to the DB.
The only problem is to upload the file, how can i pass the file to the other page?
ASKER
wouldnt that just give me the path thou?
What do you mean "pass the file to the other page"?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Since you have C# in your tags, it is probably ASP.Net (which has its own zone: https://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/), and not Classic ASP.
> " (html Input Type="File", not asp FileUpload)"
Is there any difference in the HTML? Browsers can only do a file-upload with <input type="file" />, it does not matter how you create that on the server.
In order to have the browser upload a file, the form needs to have enctype="multipart/form-da ta", otherwise no file is uploaded. That creates a totally different request to the server, but in asp.net makes it easy for you, and you can retrieve the files from Request.Files
> " (html Input Type="File", not asp FileUpload)"
Is there any difference in the HTML? Browsers can only do a file-upload with <input type="file" />, it does not matter how you create that on the server.
In order to have the browser upload a file, the form needs to have enctype="multipart/form-da
var FilePath;
FilePath = document.getElementById("F