I'm using asp:FileUpload control to upload a file to the server. Nothing fancy there, just
我正在使用asp:FileUpload控件将文件上传到服务器。没有什么好看的,只是
FileUploadId.Save();
File gets uploaded successfully, and everything is fine until I try to delete that file on the CLIENT. I get a good-old "File is being used by another person or program" message.
文件上传成功,一切正常,直到我尝试在CLIENT上删除该文件。我得到了一个古老的“文件被另一个人或程序使用”的消息。
How do I make sure that file is not being accessed on the client after it's been uploaded?
如何在上传文件后确保文件未在客户端*问?
EDIT
deleting the file has nothing to do with the application. i'm just trying to delete the file manually since i don't need it any more.
删除文件与应用程序无关。我只是想手动删除文件,因为我不再需要它了。
EDIT2
closing the browser fixed the problem ... any ideas?
关闭浏览器修复了问题...任何想法?
4 个解决方案
#1
Since the problem happens both in IE and FF: could it be that the file is locked by some AntiVirus software?
由于问题在IE和FF中都会发生:可能是文件被某些AntiVirus软件锁定了吗?
#2
The issue might be the file can be locked by the aspnet process even after uploading. Once you close the IE, the aspnet process release the file
问题可能是即使在上传后,aspnet进程也可以锁定该文件。关闭IE后,aspnet进程将释放该文件
#3
How are you trying to delete the file at the client? Unless you're hosting in WebBrowser
, or using something like an ActiveX control, you only have javascript at the client - and that doesn't provide random file access.
你是如何尝试在客户端删除文件的?除非您在WebBrowser中托管,或使用类似ActiveX控件的东西,否则您只在客户端使用javascript - 并且不提供随机文件访问。
So: what is the full setup here?
那么:这里的完整设置是什么?
#4
A thought. It may not be the file upload that is causing the problem. As the surrounding code isn't posted it's difficult to tell, but, for example, do you have a Zip manager object of some kind that you're not disposing of?
一个想法。它可能不是导致问题的文件上载。由于周围的代码没有发布,很难说,但是,例如,你有一个你没有处理的某种Zip管理器对象吗?
#1
Since the problem happens both in IE and FF: could it be that the file is locked by some AntiVirus software?
由于问题在IE和FF中都会发生:可能是文件被某些AntiVirus软件锁定了吗?
#2
The issue might be the file can be locked by the aspnet process even after uploading. Once you close the IE, the aspnet process release the file
问题可能是即使在上传后,aspnet进程也可以锁定该文件。关闭IE后,aspnet进程将释放该文件
#3
How are you trying to delete the file at the client? Unless you're hosting in WebBrowser
, or using something like an ActiveX control, you only have javascript at the client - and that doesn't provide random file access.
你是如何尝试在客户端删除文件的?除非您在WebBrowser中托管,或使用类似ActiveX控件的东西,否则您只在客户端使用javascript - 并且不提供随机文件访问。
So: what is the full setup here?
那么:这里的完整设置是什么?
#4
A thought. It may not be the file upload that is causing the problem. As the surrounding code isn't posted it's difficult to tell, but, for example, do you have a Zip manager object of some kind that you're not disposing of?
一个想法。它可能不是导致问题的文件上载。由于周围的代码没有发布,很难说,但是,例如,你有一个你没有处理的某种Zip管理器对象吗?