Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange behaviour when file is too big #181

Open
michaelbaudino opened this issue Jul 24, 2014 · 2 comments
Open

Strange behaviour when file is too big #181

michaelbaudino opened this issue Jul 24, 2014 · 2 comments

Comments

@michaelbaudino
Copy link

Hi,

When setting max_file_size (e.g. 1.megabytes) in s3_uploader_form arguments, and trying to upload a file bigger than what's allowed (e.g. a 3 megabytes file), the s3_upload_failed event is correctly fired (as stated in the doc) but the progress bar does not disappear. Is this an expected behaviour ? And we have no way to find this progressbar (in order to hide it manually) since the fired event target is the whole form.

Furthermore, in that case, the XHR answer contains some XML, e.g.:

<?xml version="1.0" encoding="UTF-8"?>
<Error>
    <Code>EntityTooLarge</Code>
    <Message>Your proposed upload exceeds the maximum allowed size</Message>
    <ProposedSize>1050232</ProposedSize>
    <RequestId>3791A0CE2BF31BD4</RequestId>
    <HostId>ccoJ4iJMGSYVYqSP85L+nXACyQCUaZxg5y0h+tpJ72699sm8V/blaMyQeMgHKICV</HostId>
    <MaxSizeAllowed>1048576</MaxSizeAllowed>
</Error>

... but the only information we have access to from the event handler is the Bad Request string in the error_thrown field of the content object (is it from the HTTP response code ?).
It would be great to have access to more specific error message as specified in the answer's XML.

Thanks in advance.

PS: if you want 2 separate issues, please let me know, I'll be glad to split it up.

@Hampei
Copy link

Hampei commented Oct 29, 2014

Workaround is to fileuploadfail instead of s3_upload_failed

$('form#fileupload').bind('fileuploadfail', function(e, data) {
setTimeout(function() {
alert($(data.jqXHR.responseXML).find("Message").text())
}, 0);

@david-a
Copy link

david-a commented Dec 2, 2015

+1 for passing the response object with the callbacks.

david-a added a commit to david-a/s3_direct_upload that referenced this issue Dec 2, 2015
As a solution for this issue: waynehoover#181
Sometimes more details about the failure is needed...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants