Return to Snippet

Revision: 49153
at July 17, 2011 15:50 by mohamedazher


Initial Code
<script language="JavaScript"><!--
function extract(what) {
    if (what.indexOf('/') > -1)
        answer = what.substring(what.lastIndexOf('/')+1,what.length);
    else
        answer = what.substring(what.lastIndexOf('\\')+1,what.length);
    alert(answer);
}
//--></script>

<form name="myform">
<input type="file" name="myfile">
<input type="button" value="Test" onClick="extract(this.form.myfile.value)">
</form>

Initial URL

                                

Initial Description
use this script to get the name of the file that you want to upload even before uploading it

Initial Title
Getting File Name of File Upload

Initial Tags

                                

Initial Language
JavaScript