解決方法:
1)頁面上放個隱藏的<input type=“file” />
2)然后加上一個文本input(type="text")和一個按鈕input(type="button")
3)點按鈕的時候調用<input type=file />的click選擇文件
4)在<input type=file />的onchange事件中把其值顯示在文本input中
5)注意把文本input設置成只讀的,防止出錯
<form name="form1"> <input type="file" name="picpath" id="picpath" style="display:none;" onChange="document.form1.path.value=this.value"> <input name="path" readonly> <input type="button" value="上傳照片" onclick="document.form1.picpath.click()"> </form>