This is a migrated thread and some comments may be shown as answers.

Uploading Multiple Files

5 Answers 996 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 17 May 2012, 03:49 AM
Hello,

I'm trying to upload multiple files at a time; I'm receiving both of the files but they're coming one after another and passing a single file rather then an array of two files like I would have hoped and expected.

Here is the code that I've written:

in Html
   <input name="docs[]" id="docs" type="file" />


in js:
$("#docs").kendoUpload({
        async: {
            saveUrl: '/Form/'+selectedSubscription.subscriptionId+'/uploadTransactionDocs',
            autoUpload: false
        },select: attachClickHandler, 
        success : function(e){
        if(e.response.status=='success'){
        docsReceivedLoad = e.response.msg;
        }
        }
    });


function attachClickHandler(e)
{
window.setTimeout(function() {
        $(".k-upload-selected").click(function(e) {
            // custom logic
        if (false) {
                e.preventDefault();
                return false;
            }
       
        });
    }, 1);
}

Any idea why the saveUrl is being called twice with two files rather then 1 time with an array of 2 files?

Thank you.
Keith

5 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 19 May 2012, 07:51 AM
Hi,

The upload does not guarantee the order or number of files per request in asynchronous mode. The exact behavior depends on the capabilities of the browser in use. We have plans to provide better control in future versions.

For now, you have to keep track of the order using metadata. Alternatively, you can use the synchronous upload.

I hope this helps.

Kind regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
zenit1
Top achievements
Rank 2
answered on 07 Nov 2012, 11:11 AM
Hi , Tsvetomir 

I observe the same behavior on MVC Q2 .

I mean , what in asynchronic multiple mode  it send files to server one by one.

I test example project from installation folder in 3 major browsers: in FF and Chrome it's send one by one and in IE multiple mode doesn't work 

Some improvements expecting in this functionality?

Best regards

Serge 


0
T. Tsonev
Telerik team
answered on 15 Nov 2012, 08:54 AM
Hi,

You can try the new batch option. When set to true the Upload will do its best to group the uploaded files into a single request.

I hope this helps.

Regards,
Tsvetomir Tsonev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Srinivasa Rao
Top achievements
Rank 1
answered on 28 Apr 2015, 07:26 PM

I am having the same issue. Only few of the files are getting uploaded (especially first and last) and rest are failing. Is there any solution for this or its confrmed thats a bug in the Kendo Upload. Please help!

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,          
batch: true   
   },             
select: function
(e) {           
onSelect(e);       
},       
success: function
(e) {       
},       
error: function
(e) {       
}

});

//Controller Method

[HttpPost]

public void GetUserUploadedFiles(IEnumerable<HttpPostedFileBase> files)
{   
  //Custom logic here
}
Is there anything i am missing or doing wrong ?

Thanks,

Srini

0
Dimiter Madjarov
Telerik team
answered on 29 Apr 2015, 08:45 AM

Hello Srinivasa,

I covered the question in the other thread on the same topic. Let's continue the discussion there.

I am looking forward to hearing from you.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Upload
Asked by
Keith
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
zenit1
Top achievements
Rank 2
Srinivasa Rao
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or