在一个请求中上传多个文件 Dropzone 发送两个请求 [英] upload multiple files in one request Dropzone sending two requests

查看:32
本文介绍了在一个请求中上传多个文件 Dropzone 发送两个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 DropZone js 在一个请求中发送多个文件.

I am trying to send multiple files in one request using DropZone js.

这是我的代码:

Dropzone.autoDiscover = false;

var myDropzone = new Dropzone('#upload-Invoices', {       
    paramName: "files", 
    maxFilesize: 3.0, 
    maxFiles: 4,
    parallelUploads: 10000,
    uploadMultiple: true,
    autoProcessQueue: false
});

$('#btnUpload').on('click', function () {
    myDropzone.processQueue();
});

控制器:

public void FileUpload( IEnumerable<HttpPostedFileBase> file )
{
    // Do Something
}

查看:

<form action="/Index/FileUpload"
      class="dropzone"
      id="upload-Invoices" data-ajax-method="POST" data-ajax="true">
    <input type="submit" value="Upload File to Server" id="btnUpload">
</form>

虽然在不同的请求中正在接收文件,但我想在一个请求中发送所有文件,Dropzone 页面有一个选项,尽管它不起作用.提前致谢

The files are being received although in diferrent requests, I want to send all files in one request, the Dropzone page has an option for it although it does not work. Thanks in Advance

推荐答案

问题是我使用了一个输入 type="submit" 它将自己做另一个帖子,将其更改为 type按钮起作用了.

The Issue was that I was using an input type="submit" which would do another post by itself, changing it to type button worked.

这篇关于在一个请求中上传多个文件 Dropzone 发送两个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆