Ticket #2529848 (closed defect)

Reporter


Renato Iwashima
Opened: 01/19/11
Last modified: 09/10/12
Status: closed
Type: defect
Resolution: wontfix

Owner


Allen Rabinovich
Target Release:
Priority: P3 (normal)
Summary: Uploader does not get response content from different HTTP status code other than 200
Description:

According to this discussion (http://yuilibrary.com/forum/viewtopic.php?f=92&t=6683), YUI Uploader SWF is not returning the response content when the HTTP status code is 4xx or 5xx.
A web service may return different HTTP status code depending on the error that happened, but it could also return a content response, so that the requester may have additional information about the
error.

An HTTP response may look like this:

< HTTP/1.1 100 Continue
< HTTP/1.1 401 Authorization Required
< Date: Tue, 18 Jan 2011 05:51:03 GMT
< P3P: policyref="<hide this>"
< cache-control: public,must-revalidate
< content-length: 68
< content-type: application/json
< Connection: close
{"error":{"xml:lang":"en-US", "detail":"Detailed error message}}

YUI Uploader SWF is only able to detect the HTTP response code (401 in the example above), but it doesn't provide the content that the http has returned.

// subscribing a function to the "uploaderror" event
uploader.on("uploaderror", function(event) {
Y.log(event);
});

Response (removing the other event object properties):
details: {
"0" : {
"id": "file2",
"status": 401,
"type": "uploaderror"
}
}

No response content provided.

Type: defect Observed in Version: 3.3.0
Component: Uploader Severity: S3 (normal)
Assigned To: Allen Rabinovich Target Release:
Location: Priority: P3 (normal)
Tags: uploader error response content Relates To:
Browsers: All
URL:
Test Information:

1. Set up a YUI Uploader to post a file to a web service (can be a php file) that returns:
HTTP status code 400
content-type: application/json
content: any json information

2. Subscribe the "uploaderror" event to a function to be able to get the event with information about the error.


uploader.on("uploaderror", function(event) {
Y.log(event);
});

3. Check console log and search for the the detailed error info you got back and verify if you got the response content from the webservice.

Change History

Adrian Ziemkowski

Posted: 02/27/11
  • version changed from 3.2.0 to 3.3.0

I agree this would be quite useful, though wouldn't the better solution be for both "uploadcomplete" and "uploaderror" to have a data property with the raw output, and the "uploadcompletedata" event be dropped entirely?

Allen Rabinovich

YUI Developer

Posted: 04/28/11
  • priority changed to P3 (normal)
  • resolution changed to wontfix
  • status changed from new to closed

Unfortunately, this is a limitation in the native functionality of the Flash player. The player itself does not provide us with any returned data unless we get HTTP 200 status back, and there is nothing we can do about it. I have voiced this as an issue to Adobe, but to date there hasn't been any movement on this. (Re Adrian: same story here: Flash provides these as separate events, and there isn't a guarantee that uploadcompletedata will fire -- it only fires with non-0 length responses, so waiting for it after uploadcomplete has fired may cause the uploader to hang).

Chris Eineke

Posted: 09/10/12

Allen, would it be possible to get this implemented for the HTML5 uploader?