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

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -