The above works in VB.NET, but I'm assuming you want it in C# (hence, the presence of it within 2 C# Zones). I'll translate it to C# for you, in case you're not familiar with VB. The code is pretty much identical, though--I didn't take the time to check for any deep-set errors.
Hope this helps,
Nate
Main Topics
Browse All Topics





by: moghazaliPosted on 2009-05-09 at 22:51:32ID: 24346943
Due to security risks, you don't get the path of the file at the client's machine. However, the file upload control (HTML or ASP.NET based) allows to you upload the file from the client into server using server-side code.
ags/att_fo rm_enctype .asp
en-us/libr ary/ system .web.ui.we bcontrols. fileupload .aspx
For non-ASP.NET web site, you must include values for action and enctype attributes of the form element in HTML. For reference, please see this link http://www.w3schools.com/t
In ASP.NET you can very easily use the FileUpload control as follows in ASPX file:
<asp:FileUpload ID="FileUpload1" runat="server" />
Use the code snippet provided at the code behind file on some event. The code sample here not only checks the availability of the file but also it's size, type, etc. before saving it.
For official documentation on FileUpload control, please see: http://msdn.microsoft.com/
Hope this helps.
Select allOpen in new window