http://www.telerik.com/help/aspnet-ajax/asyncupload-overview.html
RadAsyncUpload relies on saving temporary files to work. When posted, files are saved to the designated temp folder (App_Data/RadUploadTemp by default) with unique names.Once a postback occurs the RadAsyncUpload fires theOnFileUploaded event for each file. The target file is passed as part of the arguments to the event and can be set as either valid (default) or invalid. After the events fire, all files marked as valid are automatically saved to the TargetFolder if it’s set.
Finally, all processed temporary files are deleted. Temporary files are also deleted after a set amount of time defined by the TemporaryFileExpiration property.
TemporaryFileExpiration
Note that when a postback occurs temporary files are either saved as permanent or removed.The expiration time is used only in cases when files are uploadedasynchronously, but a subsequent postback does not occur.
Sample
Default.aspx
<telerik:RadAsyncUpload runat="server" ID="RadAsyncUpload1" OnClientFileUploaded="onClientFileUploaded"
TemporaryFileExpiration="00:01:00" OnFileUploaded="RadAsyncUpload1_FileUploaded" AllowedFileExtensions=".jpg" PostbackTriggers="RadButton1" Skin="Default"/>
<telerik:RadButton runat="server" ID="RadButton1" Text="Submit your picture and information"
OnClick="RadButton1_Click" AutoPostBack="false" OnClientClicked="updatePictureAndInfo" Skin="Default" />
<script type="text/javascript">
//<![CDATA[
var $ = $telerik.$;
function onClientFileUploaded(sender, args) {
}
function updatePictureAndInfo() {
__doPostBack('RadButton1', '');
}
//]]>
</script>
Default.aspx.cs
protected void RadButton1_Click(object sender, EventArgs e)
{
}
protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
{
foreach (UploadedFile file in RadAsyncUpload1.UploadedFiles)
{
byte[] bytes = new byte[file.ContentLength];
file.InputStream.Read(bytes, 0, file.ContentLength);
//Insert bytes Into DB
int i = 2;
}
}
Q & A:
1. RadUploadTemp folder not getting cleaned up
"Edit: Now I realise that all documents not getting cleand up have a corresponding entry in application log with this warning:"
Process information:
Process ID: 5076
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: IOException
Exception message: The process cannot access the file 'C:\Apps\405000\WebSites\PublicWeb\App_Data\RadUploadTemp\1328611694996CVMYDOC-En.pdf' because it is being used by another process.
Answer:
Your error log provides the exact reason why some of your files are not deleted:
Exception information:
Exception type: IOException
Exception message: The process cannot access the file 'C:\Apps\405000\WebSites\PublicWeb\App_Data\RadUploadTemp\1328611694996CVMYDOC-En.pdf' because it is being used by another process.
As it appears at the time when your temporary files should be removed, there is some process which is using them.