We have a intranet web app which uses AjaxControlToolkit's FileUpload mechanism to upload files from different branches of our company to the server which is hosted at HQ.
File Upload works fine. However, our problem is with deleting the file from branch computer.
Since its used within our company, we exactly know from which branch the file was uploaded (users have to select their branch from a dropdown before uploading) which allows us to delete the file from the branch after it has been uploaded. That is, say if
branch B123 uploaded hello.pdf, we have a sql table mapping of branch to its network share path. It could be something like \\B123FileShare\Uploads
So once file has been uploaded, all we do is File.Delete(\\B123FileShare\Uploads\hello.pdf).
This delete sometimes works, sometimes doesn't because of
sharing violation.
I am just wondering if once fileupload control uploads the file, does it still keeps a lock over the file from client machine? Is there a way I can release this lock (if any) before I can delete the file?
Member
112 Points
112 Posts
AJAX Control Toolkit FileUpload File Lock
Feb 17, 2015 08:52 AM|dbqasp|LINK
We have a intranet web app which uses AjaxControlToolkit's FileUpload mechanism to upload files from different branches of our company to the server which is hosted at HQ.
File Upload works fine. However, our problem is with deleting the file from branch computer.
Since its used within our company, we exactly know from which branch the file was uploaded (users have to select their branch from a dropdown before uploading) which allows us to delete the file from the branch after it has been uploaded. That is, say if branch B123 uploaded hello.pdf, we have a sql table mapping of branch to its network share path. It could be something like \\B123FileShare\Uploads
So once file has been uploaded, all we do is File.Delete(\\B123FileShare\Uploads\hello.pdf).
This delete sometimes works, sometimes doesn't because of sharing violation.
I am just wondering if once fileupload control uploads the file, does it still keeps a lock over the file from client machine? Is there a way I can release this lock (if any) before I can delete the file?
Thanks
All-Star
16806 Points
2777 Posts
Re: AJAX Control Toolkit FileUpload File Lock
Feb 17, 2015 09:12 PM|Kevin Shen - MSFT|LINK
Hi dbqasp,
No,Once you upload the file to the server ,it will not keep a lock over the file from the client side.
It seems that your issue is related with security problem.
Your user may have not permission to delete the file in the server.
Best Regards,
Kevin Shen.
Member
112 Points
112 Posts
Re: AJAX Control Toolkit FileUpload File Lock
Feb 17, 2015 11:27 PM|dbqasp|LINK
Hi Kevin,
Its not a security issue since the app is able to delete the file sometimes.
Thanks!
None
0 Points
8 Posts
Re: AJAX Control Toolkit FileUpload File Lock
Feb 17, 2015 11:53 PM|swengineer|LINK
There is no client lock on the file. Check file permissions readonly etc...
In some languages/scripts it is possible to force deletion by passing in 'true' boolean flag to 'delete' method.