Prevent folder uploading

2 posts, 0 answers
  1. Hans
    Hans avatar
    28 posts
    Member since:
    Mar 2011

    Posted 04 Oct 2013 Link to this post

    Hi, I have issue with folder uploading.
    My scenario is:
    - user drag and drop folder on Kendo uploader;
    - in method upload for Kendo uploader I check if file have't extension and it's file size is 0;
    - if yes I cancel uploading using such code:
                                                                                     e.preventDefault();
                                                                                     return false;
    - if no continue file uploading


    But for some folders I have situation when it's size is not 0.

    How I can correctly prevent folder uploading using Kendo Uploader.

    I check this in Chrome browser version Version 29.0.1547.76 m.

    My code is:
    upload: function (e) {
                        $.each(e.files, function (index, el)
                        {

                            //If we try to upload folder prevent this
                            if (el.extension === "" && (typeof el.size === "undefined" || el.size === 0)) {
                                e.preventDefault();
                                return false;
                            }

                            
                        });
                    }
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 07 Oct 2013 Link to this post

    Hi Hans,


    Detecting if the uploaded item is a folder or a file is not reliable on the client side. It is recommendable to do this on the server side. Here is a forum topic, which discusses the topic further.

    Regards,
    Dimiter Madjarov
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
Back to Top