Javascript 带字段的环回Js多部分表单
我正在使用环回进行多部分文件上载,并使用它来处理文件上载 现在我想在表单中添加字段。如何使这些参数回环Javascript 带字段的环回Js多部分表单,javascript,node.js,loopbackjs,Javascript,Node.js,Loopbackjs,我正在使用环回进行多部分文件上载,并使用它来处理文件上载 现在我想在表单中添加字段。如何使这些参数回环 <form action="http://localhost:3000/api/example/upload" method="post" enctype="multipart/form-data"> <label for="text">Text:</label> <input type="text" name="text" id="t
<form action="http://localhost:3000/api/example/upload" method="post" enctype="multipart/form-data">
<label for="text">Text:</label>
<input type="text" name="text" id="text" />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" />
</form>
您可能在请求头方面有问题:您可能在请求头方面有问题:
Example.remoteMethod(
'upload', {
http: { path: '/upload', verb: 'post' },
accepts: [
{ arg: 'file', type: 'object', http: { source:'body' }},
{ arg: 'text', type: 'string', http: { source:'body' } },
{ arg: 'req', type: 'object', http: { source: 'req' } },
{ arg: 'res', type: 'object', http: { source: 'res' } }
],
returns: { type: 'object', root: true }
}
);