nayen
1
Hi,
I am using the following to upload a file.
<button type="button" id="mybutton">Upload</button>
<input type="file" id="myfile" style="display:none" />
with
$('#mybutton').click(function () {
$('#myfile').trigger('click');
});
This works fine on Firefox and Chrome but not on Safari (v5.1.7 on Windows Vista). Any ideas how to make it work on Safari too?
Thanks.
PaulOB
2
Does it work if you use visibility:hidden instead of display:none?
<input type="file" id="myfile" style="visibility:hidden;height:0;width:0;overflow:hidden" />
Or perhaps just move it off-screen.
Won’t that leave the user without knowing what file they have selected?
nayen
3
Yea, it worked with “visibility: hidden”. Thank you.
Won’t that leave the user without knowing what file they have selected?
Thanks for pointing that out but it is not an issue in my case.