看板 Ajax 關於我們 聯絡資訊
我想使用AJAX上傳檔案至Sever,同時顯示各個檔案的上傳進度百分比 以下是我的code: <script> function pro(obj){ var file = obj.files; $.each(file, function (i,file) { var reader = new FileReader(); reader.onload = function (e) { var data = e.target.result; $.ajax({ type: "POST", url: "upload.php", contentType: "application/octet-stream", processData: false, data : data, xhr: function () { var xhr = $.ajaxSettings.xhr(); xhr.upload.onprogress = function (evt) { console.log(file.name+":"+(evt.loaded/evt.total*100)+"%"); }; return xhr; } }); }; reader.readAsArrayBuffer(file); }); } </script> <input type="file" onchange="pro(this)" multiple /> 這個code只有顯示上傳進度的部分, 但是我想要在顯示上傳進度的同時,也能在底下上傳檔案 請問我該如何讓這兩件事同時執行? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 101.138.149.166 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1472539357.A.C17.html
Canboo: 要不要使用Dropzone.js 09/05 08:21
shadowjohn: 這種工作我是覺得jquery.form最好寫 09/05 13:15