Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file upload, now can't delete

Status
Not open for further replies.

tester321

Programmer
Mar 13, 2007
150
CA
Hi, i created an upload script, it uploads csv files to a folder in iis. After i upload i display the folder items in the page, besaide each csv, i display the column heading in that csv. I have a check box and a delete button to delete the csv (individually) files in the folder. After i upload a csv, i then tried to delete the file i uploaded, am getting this error:

The process cannot access the file 'E:\ because it is being used by another process.

If i change permissions of the csv im trying to delete, to disallow anyone from opening that file, hence I break the (stream connection, if there is one open, which is my question) then i can delete the file trough the web app, after i set the permissions back to normal.

Question: any idea what might be happening? There seems to be a connection to that csv when i upload it, not sure how to break the connection. I upload load it display the csv name and the column heading to the page.
 
when you upload, you are streaming the uploaded file.

make sure that you close any stream, Filestream and Memory stream when either uploading or scanning the directory, if you not doing this, then the server will still think it's open by a process and will not allow you to modify the file.
 
I'm upload in the files with a fileUpload component. I using FileUpload.Dispose(); without luck.

I was reading on flush(); but i'm using a component. How can i tell whhat the name of the stream in teh component is, so i can try to flush that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top