This is a migrated thread and some comments may be shown as answers.

Is it possible to NOT processes uploaded files?

2 Answers 70 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
LeBear
Top achievements
Rank 1
LeBear asked on 25 Mar 2011, 09:37 PM
I'm looking for a way to prevent the automatic processing of uploaded files (moving them from the temp folder to the target folder, along with some custom processing that I put in the OnFileUploaded event) if the user doesn't explicitly ask for the files to be processed.

More detail on the scenario:  The async uploader is on a page with multiple tabs.  When the user wants to upload files, they click on a tab where the async uploader exists.  The tabs are configured to do a postback.  I think that if they were to select some files, then change their mind and move on to another tab (causing a postback), that the files shouldn't be processed.  However, I can't see a way to prevent that from happening.  I want to put a button there that lets the user "accept" the files and start processing them.

I'm looking for a supported, documented means to only process the files if explicitly fired off (via a button onclick handler, for example), and delete the temporary files on postback if the processing isn't requested.  Is this possible/available?

Thanks.

2 Answers, 1 is accepted

Sort by
0
LeBear
Top achievements
Rank 1
answered on 31 Mar 2011, 03:45 PM
FWIW, I have a solution to this, but I was looking for something more directly supported.

Essentially, I look to Request.Form("__EVENTTARGET") to determine what triggered the postback.  (This requires that my button have UseSubmitBehavior="false").  If the button was the cause of the postback, I trigger the processing of the file.  If it was not, I set e.isValid to false so that the file is not processed.
0
Genady Sergeev
Telerik team
answered on 01 Apr 2011, 09:44 AM
Hello LeBear,

Thank you for pointing this issue, indeed RadAsyncUpload will process the files on a postback, no matter whether it is from the submit button or from other control. Unfortunately, a workaround is not supported out of the box. However, the one that you have found is fine one. We will brainstorm on how to handle such scenarios and probably implement an out of the box workaround for service pack 2. Until then, I suggest that you stick to your current approach.

Regards,
Genady Sergeev
the Telerik team
Tags
AsyncUpload
Asked by
LeBear
Top achievements
Rank 1
Answers by
LeBear
Top achievements
Rank 1
Genady Sergeev
Telerik team
Share this question
or