我利用keyup事件使欄位可以自動保存到數據庫html<input type="file" id="file" name="cover" accept="image/jpeg, image/png, image/jpg">ajax$('body').on('keyup', '#content, #title', function(e){var content = $('.note-editable').html();var title = $('#title').val();var file = $('#file').val();
$.ajax({ type: "POST", url: "auto-save", data: { "content": content, "title": title, "file": file
}, dataType: "text", success: function(data){但有個問題里面有個 input file,我要如何使他能自動將檔案丟到后端去?(當 input on change的時候)但這不是form 形式,單純取值丟后端我發現加上了這個完全行不通呢enctype: "multipart/form-data",cache: false,contentType: false,processData: false,如果不透過表單的方式,怎么抓到 input file 的圖片文件,好讓我可以move_uploaded_file?
- 1 回答
- 0 關注
- 469 瀏覽
添加回答
舉報
0/150
提交
取消