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

Prevent folder uploading

1 Answer 150 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 04 Oct 2013, 02:30 PM
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;
                        }

                        
                    });
                }

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 07 Oct 2013, 07:28 AM
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!
Tags
Upload
Asked by
Hans
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or