I wanted to try using a link to trigger a hidden input file button, but after I click the link I want to get the selected file.
css
{#upload {display:none;}}
jQuery
$(".file-image").on('click', function(e){
e.preventDefault();
$("#upload:hidden").trigger('click');
console.log($("#upload"));
});
html:
<a href="#" class="file-image">Add image</a>';
<input id="upload" type="file"/>';
How can I get the value of the selected filename of the the upload-button?
In the console I see that object is like
[input#fileupload, context:document, selector: "#upload"]
[0]: input#upload
...
...
value: c:\temp\file.jpg //and this value seems to be correct
...
I tried with $("#upload")[0]['value']