Batch mode - Not working?

11 posts, 1 answers
  1. IS SAM
    IS SAM avatar
    5 posts
    Member since:
    Oct 2014

    Posted 09 Oct 2014 Link to this post

    Hi All,

    I've got the simplest upload control with batch mode enabled.

    View is;
                @(Html.Kendo().Upload().Name("uploadFiles").Async(a => a.Save("Upload", "Home").AutoUpload(false).Batch(true)))

    Controller is;
            public JsonResult Upload(IEnumerable<HttpPostedFileBase> uploadFiles)
            { 
                      return new JsonResult();
            }

    Hoping to see a single call to the action which handles the upload with multiple files. Instead, once I hit upload, I see a separate request for each file that was selected. I must be doing something wrong but finding it hard to figure out what, since the setup is so simple.

    Running it in IIS Express, however I've tried with IIS8 and that didn't work either.

    Telerik Version: 2014.2.1008
    Browser : Chrome 37.0.2062.124

    Thanks a lot.
    Chris R

  2. IS SAM
    IS SAM avatar
    5 posts
    Member since:
    Oct 2014

    Posted 09 Oct 2014 in reply to IS SAM Link to this post

    Here's the project zipped up. I've kept the NuGet package folder and Kendo.Mvc.dll out to keep the size within limits.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 10 Oct 2014 Link to this post

    Hello Chris,


    This behavior is expected. The batch mode applies to multiple files, which are selected at the same time i.e. a single list item and a single input are created for them. Files selected one after the other, as in the current case will be uploaded in separate requests.

    Let me know if this information helps or I could assist further.

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. IS SAM
    IS SAM avatar
    5 posts
    Member since:
    Oct 2014

    Posted 12 Oct 2014 in reply to Dimiter Madjarov Link to this post

    Hi Dimiter,

    Thanks  a lot for the response. Whilst fully understanding the way the control behaves as of now, may I pick your brains a bit more. 

    As you can see in the attached image, I want the user to upload multiple files with each having its own copy of meta data (A start & end date in this instance). It's essential that the files and their meta data reach the server in 1 request for the file processing and validations. Do you see me achieving this anyway in async mode without going for a form submit?

    btw I'm open for hacking the kendo js if we want to go that far. 




  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 13 Oct 2014 Link to this post

    Hi Deborah,


    You could use the following approach to attach the metadata. Each file have unique uid property which is set as data-uid attribute to the list item. You could use them to access the associated date pickers.
    E.g.
    .Events(e => e.Upload("onUpload"))
    asdf
    function onUpload(e) {
        var uid = e.files[0].uid;
        var listItem = this.wrapper.find(".k-file[data-uid='" + uid + "']");
     
        //use listItem to access the date pickers and attach metadata
    }

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. IS SAM
    IS SAM avatar
    5 posts
    Member since:
    Oct 2014

    Posted 13 Oct 2014 in reply to Dimiter Madjarov Link to this post

    Hi Dimiter,

    Thank you for your continuous help. I may have misguided the conversation by mentioning meta data - as I have no problem attaching it to the request. The problem is forcing the control to send multiple files (which were added as separate list items) in 1 request in async mode. 

    As you correctly pointed out this is not available by default through configuration. What I'm after now, is to get this working by either modifying kendo code or any other 'javascripty' way. Any guidance is much appreciated.

    Regards,
    IM
  8. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 14 Oct 2014 Link to this post

    Hi Deborah,


    At the moment this is not possible with the Kendo UI Upload widget, but you could post it as a suggestion in our Feedback portal. Regarding the custom modifications of the Kendo UI source code, such are not supported, so I could not provide technical assistance in that matter.

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  9. IS SAM
    IS SAM avatar
    5 posts
    Member since:
    Oct 2014

    Posted 10 Nov 2014 in reply to Dimiter Madjarov Link to this post

    I have posted the request in the portal - http://kendoui-feedback.telerik.com/forums/127393-telerik-kendo-ui-feedback/suggestions/6562500-enable-batch-upload-of-multiple-list-items-in-kend
  10. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 12 Nov 2014 Link to this post

    Hello Deborah,


    Thank you for posting the suggestion. If it's popular among the community and needed from other users too, we will consider to implement it in future versions of Kendo UI.

    Regards,
    Dimiter Madjarov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  11. David Yardy
    David Yardy avatar
    16 posts
    Member since:
    Aug 2007

    Posted 26 Feb 2015 in reply to Dimiter Madjarov Link to this post

    So, are we saying that using async that each file has to hit the server for each file uploaded? (so 3 files, 3 requests to server?) - Our issue is i need to associate all 3 documents to same parent record.  How best can we associate 3 uploaded documents to the same parent Id? 

    is it possible if using non-ajax? (say with form post) > is this the best only alternative?
  12. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 02 Mar 2015 Link to this post

    Hello,

    I'll update this thread for community reference, as we've already addressed the issue in a support ticket.

    The recommended approach to associate the individual uploads is to transmit the originating entity ID as metadata. Files can be stored in a temporary location until the create/update operation is complete.

    Regards,
    T. Tsonev
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET MVC is VS 2017 Ready