看板 PHP 關於我們 聯絡資訊
不知道你說的是不是這樣,小試了一下 <script language="javascript"> function insertFile(th) { var nf = document.createElement("input"); nf.type = "file"; nf.name = "files[]"; nf.files = th.files; nf.style.display = "none"; document.getElementById("form1").appendChild(nf); } </script> <form method="post" action="?do=upload" enctype="multipart/form-data" id="form1"> <input type="file" name="files[]" onchange="insertFile(this)" multiple="multiple" /> <input type="submit"/> </form> <?php if($_GET['do']=="upload") { ?> <pre> <?=var_dump($_FILES['files']);?> </pre> <?php } ?> 每選擇完一次檔案就偷塞一個input file到表單,設置一樣的欄位名稱 沒有誤會你意思的話 已測試應該沒錯~ 每次選擇的檔案都會留下 算是硬幹的方法,但試過其他方式無法達成 細節的部分(重複篩選)就比較做不出來 不然就要從後端判斷 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.112.50.144 ※ 文章網址: https://www.ptt.cc/bbs/PHP/M.1430102456.A.31A.html
xdraculax: 好久不見的原生js 04/28 02:55
gname: 原生才是王道! 04/28 08:18
hareion08: 原生才是王道!,我懶的引用Jquery 哈哈 04/28 09:24
MOONRAKER: 原生DOM煩死了 不得已要用一定自己把他包裝過 04/28 09:54
MOONRAKER: function $i(c){return document.getElementById(c)} 04/28 09:55
MOONRAKER: 這樣 04/28 09:55
mmis1000: 不考慮ie的話,原生其實還好啦...ie一堆跟w3c spec 04/28 12:21
mmis1000: 不一樣,不用jquery根本噴到死 04/28 12:21
pate123: 感謝h大,不過我需要每個瀏覽器都能夠跑得動 05/04 21:30