To delete an uploaded file in the server

kuizrul

New member
Joined
Jun 1, 2005
Messages
2
Programming Experience
3-5
Hello there

I have managed to upload a file on the server using Postedfile method. My question is how am I going to delete the same file thru a web page
 

mukesh

Member
Joined
Jun 22, 2005
Messages
11
Programming Experience
1-3
Hello Sir

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.

Thanks in advance.

bye
mukesh sharma
 

kuizrul

New member
Joined
Jun 1, 2005
Messages
2
Programming Experience
3-5
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.
 

dewbaboeram

New member
Joined
Aug 18, 2005
Messages
3
Programming Experience
1-3
DHi there,

Have you tried useing the webclient class?

wbc.UploadFile(strUri, "PUT", strFileName)
where strUri=http://www.somurl.com/directoryUpload

Dew Baboeram
 
Top Bottom