How to get full path of selected file on change of <input type=‘file’> using javascript, jquery-ajax? -


how full path of file while selecting file using <input type=‘file’>

<input type="file" id="fileupload"> <script type="text/javascript"> function getfilepath(){      $('input[type=file]').change(function () {          var filepath=$('#fileupload').val();       }); } </script> 

but filepath var contains only name of selected file, not full path.
searched on net, seems security reasons browsers (ff,chrome) give name of file.
there other way full path of selected file?

for security reasons browsers not allow this, i.e. javascript in browser has no access file system, using html5 file api, firefox provides mozfullpath property, if try value returns empty string:

$('input[type=file]').change(function () {     console.log(this.files[0].mozfullpath); }); 

http://jsfiddle.net/sck5a/

so don't waste time.

edit: if need file's path reading file can use filereader api instead. here related question on so: preview image before uploaded.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

minify - Minimizing css files -

php - How to remove letter in front of the word laravel -