RadUpload get File Name on Client

Thread is closed for posting
3 posts, 1 answers
  1. Pasha
    Pasha avatar
    2 posts
    Member since:
    Jul 2011

    Posted 15 Jul 2011 Link to this post

    I have a radUpload control
    I'd like to check file name with extension (SomeName.txt) on Client side (JS)
    is there a buildin function that i can use to get filename, NOT entire path.
    var upload = $find("<%= RadUpload1.ClientID %>")
    upload.getFileInputs()[0].value

    This code returns entire path i.e (C:\Users\Dev\Documents\SomeName.txt)
    i Just need file Name.

    or Anyone can suggest RegEx to extract file name????
    Basically i need to validate that File name doesn't contain specific character "#".
     
    Thanx.
  2. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 18 Jul 2011 Link to this post

    Hello Pasha,

    To get the filename from the full path, you could do something like this:

    var upload = $find("<%= RadUpload1.ClientID %>")
    var filePath = upload.getFileInputs()[0].value;
    var fileName = filePath.substring(filePath.lastIndexOf("\\")+1);

    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pasha
    Pasha avatar
    2 posts
    Member since:
    Jul 2011

    Posted 19 Jul 2011 Link to this post

    Thanx Kevin,
    This should work
Back to Top