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

radupload issue loosing file on post back.

2 Answers 251 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 09 May 2016, 02:23 PM

My Radupload control is not remebmering the value on post back and therefore loosing its value to upload the files.

        <telerik:RadAsyncUpload ID="rdFileUploads" TargetFolder="~\uploads\" MultipleFileSelection="Automatic" runat="server"></telerik:RadAsyncUpload>
                          

01.foreach (UploadedFile file in rdFileUploads.UploadedFiles)
02.          {
03.              tblApertureNetAttachment _attachment = new tblApertureNetAttachment();
04. 
05.              string fullPath = Server.MapPath(@"~\Uploads\");
06.              string fileName = txtRef.Text + "_" + txtFirstname.Text + "_" + txtLastName.Text + "_" + file.FileName;
07.              file.SaveAs(Path.Combine(fullPath, fileName), true);
08. 
09.        
10.          }

 

2 Answers, 1 is accepted

Sort by
0
Philip
Top achievements
Rank 1
answered on 09 May 2016, 02:40 PM
But here I am also having issue saying the file is not found in raduploadtemp?
0
Veselin Tsvetanov
Telerik team
answered on 12 May 2016, 06:42 AM
Hello Philip,

The issue is caused by the TargetFolder property that you have set to your RadAsyncupload declaration. This property forces the control to automatically save the uploaded file to the specified folder. After saving the file to that folder, the temporary file in the raduploadtemp folder is immediately deleted. Within the postback handler you are trying to save the file again, but the control fails to find the temporary file (as it is already deleted) and reports the error observed.

To resolve the issue, simply remove the TargetFolder property:
<telerik:RadAsyncUpload ID="rdFileUploads"
    MultipleFileSelection="Automatic"
    runat="server"></telerik:RadAsyncUpload>

Regards,
Veselin Tsvetanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
AsyncUpload
Asked by
Philip
Top achievements
Rank 1
Answers by
Philip
Top achievements
Rank 1
Veselin Tsvetanov
Telerik team
Share this question
or