<input type="file"/> can give an option to select the file from local machine & upload further.
But i wanted a customized button which enables to open the file browser dialog & further upload by clicking on customized button too. please see below the example. Let us assume
<input type="file" id="file-upload" /> /* file upload */
<input type="button" id="customized" /> /* simple button */
following is the jQuery fn & it enables the button to works as upload file button.
$(function(){
$('#customized').click(function() { /* cutomized button clicked */
$('#file-upload').click(); /* Now file upload button auto clicked & file browser dialog opens. */
});
});
above js works on Windows machine while it doesn't work on Linux, Why? also i know OS has nothing to do and Browser is responsible for this. Please help me to sort out this problem
Windows – – > mozila IE chrome : works, please check example
Linux not working on any browser
This is more to do with the browser version rather than the OS or Browser make.
I believe this would also fail in Opera on Windows – as some browsers prevent the firing of events on a file-type input.
You could do this old CSS trick instead – http://www.quirksmode.org/dom/inputfile.html