Deleting a file

S

Sobhan Vezzu

Hi All,


Using a webpage I am uploading the file onto webserver. First time
it works fine. If I use the same file from second time it throws an
error.

Error:
"The process cannot access the file "<FileName>" because it is being
used by another process."

My code is as follows:
If Not (File1.PostedFile Is Nothing) Then
' Create new directory if not present
If Not (Directory.Exists(strDirPath)) Then
Directory.CreateDirectory(strDirPath)
End If

' Save the uploaded file in the directory
File1.PostedFile.SaveAs(strDirPath + "\" + strFileName)
End If
Any suggestions would be appreciated.
Regards
Sobhan
 

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
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top