Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
569 views
in Technique[技术] by (71.8m points)

javascript - 在单个请求中上传多个dropzone文件(upload multiple dropzone files in single request)

I want to upload two image files in a single request with the following request body :

(我想使用以下请求正文在一个请求中上传两个图像文件:)

Form Data
signatureFile:(binary)
profileFile:(binary)

I have two separate dropzone elements as below:

(我有两个单独的dropzone元素,如下所示:)

<div class="userDetails">
    <form action="user/upload" class="dropzone" id="profileImg">

    </form>

    <form action="user/upload" class="dropzone" id="signatureImg">

    </form>

  <button (click)="upload()">Upload Profile and Signature</button>
</div>

here is my angular code :

(这是我的角度代码:)

upload() {
    Dropzone.options.profileImg = {
          paramName:"profileFile",
          uploadMultiple: true,
          autoProcessQueue: false,
          maxFiles: 2,
          parallelUploads: 2,
    };

    Dropzone.options.signatureImg = {
          paramName:"signatureFile",
          uploadMultiple: true,
          autoProcessQueue: false,
          maxFiles: 2,
          parallelUploads: 2,
    };


   Dropzone.instances[0].processQueue();
   Dropzone.instances[1].processQueue();
}

But my problem is it will only send the first parameter signatureFile not sending the profileFile parameter, see the request body

(但是我的问题是它只会发送第一个参数signatureFile而不发送profileFile参数,请参见请求正文)

Form Data
  signatureFile: (binary)

any idea what I missed, I tried so many examples from the stackOverflow and the Dropzone official website but I didn't found any useful solution for this scenario.

(任何想法,我错过了,我都尝试了stackOverflow和Dropzone官方网站上的很多示例,但是我没有找到任何适用于这种情况的解决方案。)

  ask by Mussammil translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...