how to trim Filname on fileselected or upload

4 posts, 0 answers
  1. Farrukh
    Farrukh avatar
    2 posts
    Member since:
    Jul 2013

    Posted 15 Jul 2013 Link to this post

    how to trim Filname on fileselected or upload
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Jul 2013 Link to this post

    Hi Farrukh,

    Please have a look at the following C# code I tried to trim the file name and save it on the target.

    C#:
    protected void RadAsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
    {
        string targetfolder = RadAsyncUpload1.TargetFolder;
        string newFileName = e.File.FileName.Trim();
        e.File.SaveAs(Path.Combine(Server.MapPath(targetfolder), newFileName));
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Farrukh
    Farrukh avatar
    2 posts
    Member since:
    Jul 2013

    Posted 16 Jul 2013 Link to this post

    Sir is their any way to do this at client side?

    that is when we select the files and the fileselectedpopup close

    then the file in the filelist appears as a trim with 3 dots if it's name is long
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 24 Jul 2013 Link to this post

    Hi Farrukh,

    Unfortunately I cannot replicate this issue at my end. I tried uploading a file with a lengthy file name and the file name was not automatically trimmed. As far as I know, it is not possible to change the file name on selection using client code.

    Thanks,
    Shinu.
Back to Top