2012年11月29日 星期四

[HTML][JavaScript] How to Upload file by using Javascript & HTML


[HTML][JavaScript] How to Upload file by using Javascript & HTML



JAVASCRIPT :



function fileUpload()

{

   var form=document.forms[0];



   form.loadfile.value=form.happy.value;

}



HTML :



<button class="upc_button4 width150" type="button" onclick="document.forms[0].happy.click();"><span>Upload file</span></button>'

<input style="visibility: hidden" type="FILE" name="happy" size="40" maxlength="128" onchange="fileUpload();">'

<input size="32" name="loadfile" maxlength="32" value="" type="text" class="width150" style="margin-left:-215px;" readonly><div class="clear">&nbsp;</div>'



Reference :




  1. Ajax file upload with pure JavaScript


  2. safari and fileupload form doesnt work


  3. 模拟input type=file


Related Posts:

0 意見:

張貼留言