I have a web application where client can upload files using the FIleUpload ASP.NET control. Is it a way for me to know that upload is finished so I can for example kill the session?
Asked
Active
Viewed 128 times
0
-
upload finish as soon as you read the file, show some code pls – Arsen Mkrtchyan Feb 13 '14 at 11:13
-
Agreed, but imagine that many users may be online trying to upload many different files and I need to know if an upload is in progress server side. – Melkor S.K Feb 13 '14 at 12:28
-
keep thread-safe count of uploaders, increment/decrement when upload starts finish, if count = 0 no uploading in progress... – Arsen Mkrtchyan Feb 13 '14 at 12:30
-
ASP.NET handles such concurrencies internally unless and until you are not implementing multi-threading by yourself (i think but not very sure) – samar Feb 13 '14 at 12:34
-
@samar, ASP.NET handles thread safety of all objects like HttpContext and etc. but never will do synchronization for your logic – Arsen Mkrtchyan Feb 13 '14 at 12:57
-
@ArsenMkrt. Correct. But how do I know upload is finished? Back to my initial question – Melkor S.K Feb 13 '14 at 13:11
-
@MelkorS.K as I said, as soon as you complete reading the stream, the upload finished, show some code, how are you reading the file? for example after FileUploadControl.SaveAs(...); method file is read, and upload is finished(if no exception of course) – Arsen Mkrtchyan Feb 13 '14 at 13:22
-
Solved it with FileSystemWatcher. This helped a lot. http://stackoverflow.com/questions/3822175/filesystem-watcher-and-large-files – Melkor S.K Feb 13 '14 at 15:03