Node.js 将文件对象直接传递给nodejs模块
我知道form.parse(req,…)将在单击“提交”按钮时解析传入的“formpost”请求。如果我想通过对文件对象使用ajax调用来模拟“单击提交按钮”,我应该怎么做 我是这样写的,但现在开始工作了Node.js 将文件对象直接传递给nodejs模块,node.js,formidable,Node.js,Formidable,我知道form.parse(req,…)将在单击“提交”按钮时解析传入的“formpost”请求。如果我想通过对文件对象使用ajax调用来模拟“单击提交按钮”,我应该怎么做 我是这样写的,但现在开始工作了 $('#uploadFilesInput').change(function() { var fileObjs = $(this).val(); window.alert(fileObjs); $.ajax({ url:
$('#uploadFilesInput').change(function() {
var fileObjs = $(this).val();
window.alert(fileObjs);
$.ajax({
url: "/upload",
context: fileObjs,
method: "POST"
}).done(function() {
window.alert("test")
});
});
感谢您的帮助。上下文:fileObjs,应该是
数据:fileObjs
。否则它不会向服务器发送任何内容