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

RadAsyncUpload save File whit new name

4 Answers 1203 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Emiliano
Top achievements
Rank 1
Emiliano asked on 02 Sep 2013, 02:27 PM
before we start I apologize for my English.

I have:
<telerik:RadAsyncUpload ID="RadAsyncUpload1"  AllowedFileExtensions="JPG,gif,png,jpg,tif,tiff" MaxFileInputsCount="3"  OnClientValidationFailed="OnClientValidationFailed"   OnFileUploaded="RadAsploayncUd1_FileUploaded"  runat="server" ChunkSize="0" Culture="it-IT" PostbackTriggers="pulsante"></telerik:RadAsyncUpload>
<asp:Button  runat="server" ID="pulsante" Text="Aggiorna profilo"  OnClick="Button1_Click" /> 

//and in the code:


protected void RadAsploayncUd1_FileUploaded(object sender, FileUploadedEventArgs e)
        {
            RadAsyncUpload1.TargetFolder = "~/App_CProfili/ImgProfili/";
          
           }


So it works, but if I change the file name tells me that the file 'App_Data\RadUploadTemp\1378131589339001.JPG'.
 was not found". For example, if I load three files are loaded only two and then goes into error


 This is the code that produces the error
protected void RadAsploayncUd1_FileUploaded(object sender, FileUploadedEventArgs e)
{           
 e.File.SaveAs(Server.MapPath(Path.Combine(RadAsyncUpload1.TargetFolder, e.File.GetNameWithoutExtension() + User.Identity.Name  + e.File.GetExtension())));
}
           

4 Answers, 1 is accepted

Sort by
0
Emiliano
Top achievements
Rank 1
answered on 02 Sep 2013, 03:41 PM
The error that I described may be due to the free version of Telerik?
The same code works on the computer where you installed the paid version.
0
Shinu
Top achievements
Rank 2
answered on 03 Sep 2013, 07:36 AM
Hi Emiliano,

The free version of Telerik DLL has nothing to do with this issue. You can check the following code I tried which works fine at my end.

ASPX:
<telerik:RadAsyncUpload ID="RadAsyncUpload1" AllowedFileExtensions="JPG,gif,png,jpg,tif,tiff"
    MaxFileInputsCount="3" OnClientValidationFailed="OnClientValidationFailed" runat="server"
    ChunkSize="0" PostbackTriggers="pulsante" OnFileUploaded="RadAsyncUpload1_FileUploaded">
</telerik:RadAsyncUpload>
<asp:Button runat="server" ID="pulsante" Text="Aggiorna profilo" OnClick="pulsante_Click" />

C#:
protected void RadAsyncUpload1_FileUploaded(object sender, Telerik.Web.UI.FileUploadedEventArgs e)
{
    RadAsyncUpload1.TargetFolder = "~/App_CProfili/ImgProfili/";
    string newfilename = e.File.GetNameWithoutExtension() + User.Identity.Name.Replace("\\",String.Empty) + e.File.GetExtension();
    e.File.SaveAs(Path.Combine(Server.MapPath(RadAsyncUpload1.TargetFolder), newfilename));
}

Thanks,
Shinu.
0
Emiliano
Top achievements
Rank 1
answered on 03 Sep 2013, 01:15 PM
Hello,ShinlmaWVyPjxJbnN0YW5jZT51cm46dXVpZDthank you!
0
Nirosha
Top achievements
Rank 1
answered on 18 Apr 2017, 09:53 AM

Hi

is there any possibility instead of saving files in folder save as image in telerik document Manger using c#.

If possible can you please suggest the code.

Thanks,

Nirosha

Tags
AsyncUpload
Asked by
Emiliano
Top achievements
Rank 1
Answers by
Emiliano
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Nirosha
Top achievements
Rank 1
Share this question
or