Single Control & Drop Zone for File Upload and Directory Upload

4 posts, 1 answers
  1. Rodney Foley
    Rodney Foley avatar
    72 posts
    Member since:
    Oct 2009

    Posted 25 Jan 2019 Link to this post

    I was looking at the demos and playing around with the upload control.  It seems that its designed to either be File uploads or Directory uploads, not do both at the same time. It seems we would would have to have two buttons one to allow choosing files and one to allow choosing a directory. The same with drop locations we could have a custom zone that accepts files and we would have to have another custom zone that only accepts a directory.

    Below are some scenarios to help explain. I would love to know if all of these scenarios are possible and if so how. If they all of them are not then I would like to know what the reasoning is behind this limitation.

    Scenario One

    The user click an "upload" button that they can choice either 1 or more files, or 1 or more directories and the control will handle uploading all of them

    Scenario Two
    The user drags some files to a drop location and it detects they are files and uploads

    Scenario Three
    The user drags one or more directories to the same drop location as above and it detects they are directories and uploads the files represented within

  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    5427 posts

    Posted 29 Jan 2019 Link to this post

    Hi Rodney,

    The folder upload is allowed by the browser through the attributes on the <input type="file" /> that is used to allow file selection. This makes the browser handle clicking on it in a completely different manner (assuming it supports the feature - at the moment only Chrome, Firefox and Edge support it). This is not something that can be controller with the application code as it goes into the client OS and that's something browsers don't allow you to touch for security reasons. You can try the override for dropping items from the following post, yet I cannot guarantee it will not cause issues in newer versions: https://www.telerik.com/forums/kendoupload-directorydrop-both-folders-and-files#O51l2xqohEe2a0vb2A6iQA.

    To tie this to the listed scenarios:

    • choosing either files, or folders with the same widget - this is not possible because the selection dialog the browser displays depends on the attributes of the input element. If you change those attributes, the selection dialog will change, but the widget cannot know when to change them on its own.
    • detection whether files or folders are dropped - you could post a feature request for this to get implemented in the Feedback portal: https://feedback.telerik.com/kendo-jquery-ui?listMode=Recent&categoryId=894. For the time being you can try the override above.
    • dragging folders - when directory upload is enabled this should work, you can test it in the demo: https://demos.telerik.com/kendo-ui/upload/directoryupload

     


    Regards,
    Marin Bratanov
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Rodney Foley
    Rodney Foley avatar
    72 posts
    Member since:
    Oct 2009

    Posted 29 Jan 2019 Link to this post

    Thanks Marin! We thought pretty much the same about limitations on the button and its nice to have confirmation. Thanks for the links and we were able to work out a solution for drag and drop supporting either time in one drop zone. 
  4. Uwe
    Uwe avatar
    16 posts
    Member since:
    Mar 2008

    Posted 26 Mar 2019 in reply to Rodney Foley Link to this post

    Could you share the solution you mentioned that you implemented?

    I'm looking for a way to accept dropping of files and folders in the same upload control, too.

Back to Top