Author: multiplex7777 | Posted on: 3/22/2007 6:17:15 AM | Views : 539

Hi everyone,
I'm having some difficulty with my File upload and File delete processes.
For the Upload, I do like:
sTempName = path + FileUpload1.FileName;
FileUpload1.PostedFile.SaveAs(sTempName); //sTempName = C:\Inetpub\vhosts\myfile.jpg
It works fine on my local machine, but once I upload it to my remote server, I sometimes (about 1 in 8 times) hit this exception:
System.IO.IOException: The process cannot access the file 'C:\Inetpub\vhosts\myfile.jpg' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode)
   at System.Web.HttpP ...

Go to the complete details ...