简体   繁体   English

我想从 SailsJS 中的不同文件输入上传文件

[英]I want to upload files from different file inputs in SailsJS

await sails.upload(inputs.logo);

await sails.upload(inputs.thumbnail);

I use sails-hook-uploads.我使用sails-hook-uploads。 Only the first incoming file (logo, in my case) is uploaded and for thumbnail, it shows this message.只有第一个传入的文件(在我的例子中是徽标)被上传,对于缩略图,它会显示此消息。

Upstream (file upload: thumbnail ) emitted an error: { Error: EMAXBUFFER: An upstream ( thumbnail ) timed out before it was plugged into a receiver.上游(文件上传: thumbnail )发出错误:{ 错误:EMAXBUFFER:上游( thumbnail )在插入接收器之前超时。 It was still unused after waiting 4500ms.等待 4500 毫秒后仍未使用。 You can configure this timeout by changing the maxTimeToBuffer option.您可以通过更改maxTimeToBuffer选项来配置此超时。

Is there anyway I can fix that or alternative simple way to upload files from different file inputs in sailsjs?无论如何我可以解决这个问题或替代简单的方法来从sailsjs中的不同文件输入上传文件吗?

Since you are uploading files one by one, try using uploadOne.由于您正在逐个上传文件,请尝试使用uploadOne。

await sails.uploadOne(inputs.logo);

await sails.uploadOne(inputs.thumbnail);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM