Link to home
Start Free TrialLog in
Avatar of virafh
virafh

asked on

FileUpload Control with javascript

Dear Friend,

i want to check the extension of the file when the user select the file by using the FileUpload control

i have javascript but i want it to call when the user select the file and after click on the open button.

so how can i call to javascript when the user select the file.

Thanks

Avatar of Ivo Stoykov
Ivo Stoykov
Flag of Bulgaria image

if(document.selectElementById('your_file_field_id).value.lastIndexOf('txt') < 0)
alert('not found')
else
alert('correct');
HTH
Ivo Stoykov
i think this cannot be done with simple FILEUPLOAD control, you need to create a usercontrol which inhertis the fileupload control and perform client script actions.
ASKER CERTIFIED SOLUTION
Avatar of Member_2_4913559
Member_2_4913559
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of virafh
virafh

ASKER

thankx ddayx10

your script is working
 now i just want to blank the fileUpload textbox

how can i ?
Avatar of virafh

ASKER

Thank You :)
Avatar of virafh

ASKER

in firefox its not working

 onpropertychange="fileCheck();"

if you know the solution please let me know

thanks
Avatar of virafh

ASKER



buddy i solved it, instead of onpropertychange i using onchange


thankx all of you