File uploaded to server....How can I delete it?

D

daiski

Hi,

I have uploaded an image to the web server using the code below. Note
that 'FileUpload' is the name of my HTML input control.

if (FileUpload.PostedFile != null)
{
String virtualPath = "~/uploads/" + Path.GetFileName
(FileUpload.PostedFile.FileName);
String phyiscalPath = Server.MapPath(virtualPath);
FileUpload.PostedFile.SaveAs(phyiscalPath);
}

I save the physicalPath and virtualPath in SQL DB for image retrieval.

QUESTION: How can I delete the image 'physically' from the web server
if I dont need it any more??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,143
Messages
2,570,822
Members
47,368
Latest member
michaelsmithh

Latest Threads

Top