Dropzone没有将文件绑定到asp.net mvc中的控制器

时间:2016-03-26 14:37:43

标签: javascript asp.net-mvc dropzone.js

我无法使用dropzone.js将文件发布到控制器。我有一个参数IEnumerable文件。除dropzone文件外,可以发布所有数据。 我的代码:

// HTML

<div class="jumbotron">
     <div class="dropzone" id="dropzoneForm">
         <div class="fallback">
            <input name="files" type="file" multiple/>
         </div>
     </div>
</div>

//使用Javascript:

    Dropzone.autoDiscover = false;

    var myDropzone = new Dropzone("div#dropzoneForm", {
        url:'/TravelPlaces/Create',
        paramName: 'files',
        autoProcessQueue: false,
        uploadMultiple: true,
        parallelUploads: 25,
        maxFiles: 5
    });

    //Called by submit 
    function uploadClicked() {
        myDropzone.processQueue();
    }


    //Here is my Controller Code:
    // I have two other file uploader in the same form as well.

    public ActionResult Create([Bind(Include = "TravelPlaceID,Title,PlaceDescription,Logo,CountryID,State,ProvinceID,DistrictID,Address,Location,OtherMap,ServicesID")] TravelPlace travelPlace,HttpPostedFileBase Logo,HttpPostedFileBase OtherMap,IEnumerable<HttpPostedFileBase> files)
  {
      foreach (var p in files)
      {
        var z = p.FileName;
      }

   }

0 个答案:

没有答案