javascript - Kendo UI multiple files upload issue -


i using kendo file upload control upload multiple files. few of files getting uploaded (especially first , last) or random ones. there solution ?

index.cshtml :

<input name="files" id="files" type="file" multiple="multiple" /> 

js file :

$("#files").kendoupload     ({         async: {             saveurl: "/controller/getuseruploadedfiles",             removeurl: "/controller/remove",             autoupload: false,             allowmultiple: true         },         select: function (e) {             onselect(e);         },         success: function (e) {         },         error: function (e) {         }     }); 

//controller method

[httppost]    public void getuseruploadedfiles(ienumerable<httppostedfilebase> files)    {         //custom logic here    } 

also, great if can files enumerable in 1 controller method call rather having called multiple times multiple files.

is there missing or doing wrong ?

thanks, srini

this code upload files selected in kendo upload, , run code on each.

[httppost] public void getuseruploadedfiles() {        request.content.loadintobufferasync().wait();     var result = task.factory                  .startnew(() => request.content.readasmultipartasync().result,                   cancellationtoken.none,                   taskcreationoptions.longrunning,                   taskscheduler.default).result;      var contents = result.contents;     httpcontent httpcontent = contents.first();              stream file = httpcontent.readasstreamasync().result;      if (file.canread)     {         // code executed on each file     } } 

you can filename using:

string filename = httpcontent.headers.contentdisposition.filename.replace("\"", string.empty); 

you can uploaded file media type using:

string uploadedfilemediatype = httpcontent.headers.contenttype.mediatype; 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -