Upload e.preventDefault() issue

2 posts, 0 answers
  1. J
    J avatar
    4 posts
    Member since:
    Feb 2012

    Posted 22 Feb 2012 Link to this post

    Hey,

    I am trying to prevent users from uploading exe's || zip's, I am calling the below script on the select event .

    this.onSelect = function(e) {
    $.each(e.files, function(index, value) {
                    if(value.extension=='.zip' || value.extension=='.exe') {
                        e.preventDefault();
                        return;
                    }
    }
    }

    This prevents the file from appearing in the file list but if I do a submit the zip's are going to the server. I could see input type 'file' elements are getting created even though filelist is not displaying the same. Whats the way around for this
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 23 Feb 2012 Link to this post

    Hi,

    Thank you for reporting this problem. We've fixed it and the fix will be available in the next release. You can use the following workaround for now:
    e.preventDefault(e);
    setTimeout(function() {
        $("input[name='files']:hidden:last", $("#files").parent()).remove();
    });

    As a token of gratitude for your involvement your Telerik points have been updated.

    All the best,
    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!
Back to Top