/ Published in: JavaScript

use this script to get the name of the file that you want to upload even before uploading it
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
Comments
