Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

disallowed file types are getting uploaded with jquery-ui version #2894

Closed
xenDev opened this issue Jan 21, 2014 · 3 comments
Closed

disallowed file types are getting uploaded with jquery-ui version #2894

xenDev opened this issue Jan 21, 2014 · 3 comments

Comments

@xenDev
Copy link

xenDev commented Jan 21, 2014

when files are added, "filetype not allowed" message is correctly shown but when "start uploads" is clicked, the disallowed filetype is uploaded anyway. The file is unnecessarily transferred to be only rejected by, hopefully, server side checks.

adding an additional check for !data.files[0].error in jquery.fileupload-ui.js fixes the bug for me but I am not sure if this is the best way.

    _startHandler: function (e) {
        e.preventDefault();
        var button = $(e.currentTarget),
            template = button.closest('.template-upload'),
            data = template.data('data');
        button.prop('disabled', true);
        if (data && data.submit  && data.files[0].error ) {
            data.submit();
        }
    },
@blueimp
Copy link
Owner

blueimp commented Jan 21, 2014

Closing as not reproducible on the demo.
The start button is rendered disabled at the start and is only enabled if validation passed:
https://github.com/blueimp/jQuery-File-Upload/blob/master/index.html#L161
https://github.com/blueimp/jQuery-File-Upload/blob/master/js/jquery.fileupload-ui.js#L112

@blueimp blueimp closed this as completed Jan 21, 2014
@xenDev
Copy link
Author

xenDev commented Jan 21, 2014

i am able to reproduce on the demo using "jQuery UI" version using Firefox 26.0 and Chrome 32.0 . Please try uploading an exe file. Both "Start" & "Start Uploads" buttons are enabled. After clicking it, you will see the progress bars moving.

Looks like you tested with "Basic Plus UI".

This commit recently fixed the bug for "Angular JS" version.
46fea69

@blueimp
Copy link
Owner

blueimp commented Jan 21, 2014

You are indeed correct, sorry I missed that you were actually referring to the jQuery UI version.
Will commit a fix shortly.

@blueimp blueimp reopened this Jan 21, 2014
dougdomeny pushed a commit to dougdomeny/jQuery-File-Upload that referenced this issue Feb 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants