Pls. don't mind. Actully i m searching "How can we upload the images(ex. .jpg) to the server" in asp.net. U have done this task. So, can u help me for this task.
hi mukesh. well what ive done is that first u'll need to add the <input> tage in the page. E.g <input id="txtUpload" runat="server">. by having this tag, it will enable u to browse for specific file in ur comp to be upload. after that to upload the file all u have to do is using this code : txtUpload.PostedFile.SaveAs(<path where u want to upload the file>)
Make sure to import the System.IO namespace before using this upload method. For example if u want to save it in the server u can use the server.mappath method. The code :
Dim sPath as String
sPath = Server.MapPath(".")
txtUpload.PostedFile.SaveAs(sPath)
will store the selected file in the same folder where ur page is. Hope this will help u.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.