Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有 html 表单,我正在使用 jquery 提交表单,其中包含以下内容
var queryString = $('.form1').formSerialize(); $.post('book/create/', queryString);
但是,如果我提交没有 ajax 的表单,那么图像会由 django 函数上传
现在的问题是,它忽略了文件字段。我该怎么办
您无法使用 XMLHttpRequest (AJAX) 上传文件。但您可以尝试使用一些 Ajax JQuery 插件上传文件
另请检查how-can-i-upload-files-asynchronously-with-jquery