How do I get the full path file from <input type="file />
?
I kept getting C:\fakepath\[filename]
Here 's my script
$(function(){
$('button').click(function(){
alert($('input#path').val());
});
});
<input type="file" id="path" />
<button>Read</button>
What I want to do is to pass the file path from Javascript to PHP then read/rewrite it.
UPDATE: I tried the following but I still get the fakepath. Im using Chrome.
$(function(){
$('button').click(function(){
$.post(
'test2.php', {
path: $('input#path').val()
}, function(data){
alert(data);
}
);
});
});
test2.php
<?php
echo $_POST['path'];
?>