I am using an AsyncFileUpload control in my aspx.net page. This control is running inside an update panel.
I can successfully upload files to the server asynchronously.
My problem is that I can't refresh the entire page after each file is uploaded, so I need to figure out how to clear up the last uploaded file, so when the user selects a new file to upload, the old file does not appear in the control and the control does not keep its last upload in ViewState.
I have tried this http://www.aspsnippets.com/Articles/Clear-contents-of-AsyncFileUpload-Control-after-upload-and-page-revisit.aspx but it only clears up the html, when I do the server async postback, the AsyncFileUpload control still has the last file uploaded.
Is there a way to do the clean up at server side? Perhaps anything related to view state?
Any help would be appreciated, Thank you.
and
that one works perfectl on all modern browsers, thanks to "Scotty.NET"
On the client side you can use
OnClientUploadComplete
event to clear up the last uploaded file entry. Once the file uploading is completed and when the postback occurs theAsyncFileUpload1.HasFile
will returnfalse
.In
aspx
page:and inside JavaScript tags:
This worked for me :
Server side clearing worked for me :
reference: link in the question by Fer. http://www.aspsnippets.com/Articles/Clear-contents-of-AsyncFileUpload-Control-after-upload-and-page-revisit.aspx