Tag: jquery forms plugin

上传一个文件并传递一个附加的参数与multer

我正在使用jQuery Form Plugin和multer上传文件到我的服务器。 这工作得很好,但我想传递一个额外的参数,这将决定在哪里确切的文件将被保存。 我有下面的代码,我想扩展到performance如下: HTML <form id="uploadForm" enctype="multipart/form-data" action="/files" method="post"> <input type="file" id="userFile" name="userFile"/> <input type="text" hidden id="savePath" name="savePath" value="path"/> </form> 客户JS uploadForm.submit(function() { $(this).ajaxSubmit({ error: function(xhr) { console.log('Error: ' + xhr.status); }, success: function(response) { console.log('Success: ' + response); } }); return false; }); Node.js路由 app.post(APIpath + "file",function(req,res){ var storage = multer.diskStorage({ destination: […]