Javascript File Name Alert While File Upload

How to Get File Name While Upload

The below function for Getting file name while file upload is written in Javascript used to give you an alert containing the file name of the file to be uploaded. The alert file prompt your confirmation to upload the file

Javascript Code to Get File Name While Upload


<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>


Related Topic How to Check File Size in Javascript on Upload
Javascript Spell Checker Embedded Code, Text Area Object
Force User to Select the Download File in PHP
Javascript Dynamic File Loader using jQuery
How to Install Anti-virus ClamAV

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback