I am trying to make a server page (C#, asp.net 2.0+) to save an uploaded file from another page.
Specifically,
I have an HTML page with a
<form action="upload.aspx">
and I can’t figure out how to handle saving the file on the server in upload.aspx.
I found a few examples (one being: http://msdn.microsoft.com/en-us/library/aa479405.aspx)
but that requires the <input type=file> element to be on the same page.
I am having difficulties with grabbing the posted file on my upload.aspx page.
Anyone have any pointers? How can I grab a posted file in aspx and save it to the server when the file is posted from another page?
Many thanks,
Brett
1.Create Uploadfile.aspx, code as below:
2.create
Uploadfile.aspx.cs, code as below:3.create a new file:
demo.html, code shown as below, (embed the Uploadfile.aspx in Your Html page using iframe)4.visit
/demo.html, now you can be able to upload your file from html itself,by using UploadFiles.aspx