RadAsyncUpload save File whit new name

4 posts, 0 answers
  1. Emiliano
    Emiliano avatar
    8 posts
    Member since:
    Aug 2013

    Posted 02 Sep 2013 Link to this post

    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())));
    }
               
  2. Emiliano
    Emiliano avatar
    8 posts
    Member since:
    Aug 2013

    Posted 02 Sep 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Sep 2013 Link to this post

    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.
  5. Emiliano
    Emiliano avatar
    8 posts
    Member since:
    Aug 2013

    Posted 03 Sep 2013 Link to this post

    Hello,ShinlmaWVyPjxJbnN0YW5jZT51cm46dXVpZDthank you!
Back to Top