Upload file clearing question

Paul

Upon dealing with an invalid Form on postback (either caused by a custom invalid file upload or another invalid control on the same form), I'm curious as to whether this code will clear uploaded files from memory and the temp directory (for security and resource purposes).

FYI - I have not set an "TargetFolder" or an "TargetPhysicalFolder" property of my RadUpload control (I'm saving to DB). I imagine that files are handled in memory 100% because I have not set these properties. Is this true?

RadUpload1.InvalidFiles.Clear();

RadUpload1.UploadedFiles.Clear();

Is this code necessary at all?

Any insight you can provide as to how RadUpload handles clearing uploaded files would be greatly appreciated.

Thanks in Advance,
Paul

Answer

Erjan Gavalji

There is no necessity for the Clear call. Here are the details you requested:

Since version 2008.2.723 RadUpload only "reads" the upload information, leaving the file handling to the ASP.NET itself. The uploaded files are handled by the HttpWorkerRequest and are saved in a temporary location (in contrast, ASP.NET 1.x stored the files in the memory).
The Clear() call simply clears the collection, but does not clear the files, which are saved in the temporary location.
The temporary files get cleared by the ASP.NET during the End_Request phase (or on application shutdown).

I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.