html - How to get Full Path using JQUERY of a uploaded file when use <input type="file"> in all browser and why IE,Chrome gives "c:/fakepath/filname" return? -
this question has answer here:
- how resolve c:\fakepath? 8 answers
here in code use <input type="file>
, want full path after user browse file.
html
<input class="file_upfile" type="file" /> <input class="btn_showpath" type="button" value="show full path"/> <p class="p_upfilepath">full path display here<p>
here use $('.classname').val();
function return filename.txt(e.g) in firefox , if use same code in ie , chrome return "c:/fakepath/myfilename.txt"
jquery
/* here <p> show file name, want full path of file "c:\something\folder\filename.txt" */ $('.btn_showpath').click(function(){ var getpath = $('.file_upfile').val(); $('.p_upfilepath').slideup(function(){ $('.p_upfilepath').text('"'+getpath+'"').slidedown(); }); });
css
.p_upfilepath{ background:#aaaaaa; padding:3px 10px; width:auto; color:#555555; }
i think cant full path of file .
or file stored on remote users machine dosent matter file located . browsers have security feature prevents javascript or script knowing file's local full path. makes sense - client, don't want server know local machine's filesystem.
Comments
Post a Comment