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

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

问题描述

我试图用悬浮窗JS发送一个请求,多个文件。

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

下面是我的code:

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>

该文件被接受虽然在diferrent的要求,我想送一个要求的所有文件,在悬浮窗页有它的一个选项,虽然这是行不通的。
由于提前

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

推荐答案

的问题是,我使用的输入类型=提交这将自行完成的另一篇文章,改变它输入按钮的工作。

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

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

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