Could not find file 'C:\inetpub\wwwroot\source\App_Data\RadUploadTemp\16378221455987_23.PNG.tmp'. On Uploading a File via RadAsyncUpload

1 Answer 164 Views
AsyncUpload
Vinay
Top achievements
Rank 1
Vinay asked on 09 Dec 2021, 07:33 AM

Facing the exception Could not find file 'C:\inetpub\wwwroot\source\App_Data\RadUploadTemp\16378221455987_23.PNG.tmp'. while uploading a file from RadAsyncUpload Control on an aspx Page, at the line 5 while trying to read the InputStream.

The Code is like below on Codebehind file;

Protected Sub AsnycUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs) Handles AsnycUpload1.FileUploaded
Try
Dim file As UploadedFile = AsnycUpload1.UploadedFiles.Item(0)
Dim bytes(file.ContentLength - 1) As Byte
file.InputStream.Read(bytes, 0, bytes.Length)
file.InputStream.Dispose()
Catch ex As Exception
doh(ex)
End Try
End Sub

please help in resolving the issue!

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 30 Jul 2025, 10:05 AM

Hi Vinay,

The exception "Could not find file ... RadUploadTemp....tmp" typically occurs when the RadAsyncUpload control cannot locate the temporary file it created during the upload process. Here are the main points to consider based on your scenario and code:

1. Cause: Use of TargetFolder and File Access Timing

  • If you have set the TargetFolder property on the RadAsyncUpload control, the uploaded file is moved to that folder and the temporary file in the RadUploadTemp directory is deleted immediately after the upload. If you try to access the file's InputStream after this, the file no longer exists in the temp folder, resulting in the error.
  • In web farm or cloud environments like Azure, the temp folder must be shared across all instances as explained in the For more information see the How to integrate RadControls for ASP.NET AJAX in a WebFarm or WebGarden scenario blog post. Otherwise, the file may be uploaded to one instance but the processing code runs on another, causing a file not found error.

2. Issues in Your Code

  • You are accessing the uploaded file using AsnycUpload1.UploadedFiles.Item(0), but inside the FileUploaded event, you should use e.File to get the current file.
  • Make sure you’re not trying to access the file after it has already been moved/deleted by the control.

Correct usage:

Protected Sub AsnycUpload1_FileUploaded(sender As Object, e As FileUploadedEventArgs) Handles AsnycUpload1.FileUploaded
    Try
        Dim file As UploadedFile = e.File
        Dim bytes(file.ContentLength - 1) As Byte
        file.InputStream.Read(bytes, 0, bytes.Length)
        ' Process the file as needed
    Catch ex As Exception
        doh(ex)
    End Try
End Sub
  • Check if TargetFolder is set: If so, remove it and handle file saving manually in the event handler.
  • Ensure temp folder exists and permissions are correct: The App_Data\RadUploadTemp folder must exist and have read/write permissions for the application pool.
  • Web Farm/Azure: Ensure the temp folder is shared across all instances.

4. The error is discussed in great detail in these forum threads: 

System.IO.FileNotFoundException: Could not find file

RadUpload failed due to could not find TMP file when submitted.

5. [Alternative approach] Saving the uploaded file without a temp folder
You can save the uploaded files directly without a temp folder - https://www.telerik.com/forums/radasyncupload-without-temporary-file#2715229

     

      Regards,
      Rumen
      Progress Telerik

      Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
      Tags
      AsyncUpload
      Asked by
      Vinay
      Top achievements
      Rank 1
      Answers by
      Rumen
      Telerik team
      Share this question
      or