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

RadUpload get File Name on Client

2 Answers 835 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Pasha
Top achievements
Rank 1
Pasha asked on 15 Jul 2011, 07:11 PM
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 Answers, 1 is accepted

Sort by
0
Accepted
Kevin
Top achievements
Rank 2
answered on 18 Jul 2011, 01:59 PM
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.
0
Pasha
Top achievements
Rank 1
answered on 19 Jul 2011, 05:45 PM
Thanx Kevin,
This should work
Tags
Upload (Obsolete)
Asked by
Pasha
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Pasha
Top achievements
Rank 1
Share this question
or