[ 4 posts ]

Alessandro Vernet

  • Username: avernet
  • Joined: Tue Mar 24, 2009 6:36 pm
  • Posts: 14
  • Twitter: avernet
  • GitHub: avernet
  • Gists: avernet
  • Offline
  • Profile

Connection Manager: file upload failure function not called

Post Posted: Thu Jan 06, 2011 4:28 pm
+0-
I am using the Connection Manager to upload files, through setForm() / asyncRequest(). When the upload succeeds, callback.upload is properly called. However, when it fails (say because of a connection issue), then callback.failure isn't called.

Is callback.failure supposed to be called, or am I using the API incorrectly?

Alex

Thomas S. Sha

YUI Contributor

  • Username: tsha
  • Joined: Thu Jan 08, 2009 10:16 am
  • Posts: 206
  • Offline
  • Profile

Re: Connection Manager: file upload failure function not cal

Post Posted: Thu Jan 06, 2011 5:19 pm
+0-
The file upload use case does not fire either a success or failure event. Instead, the "complete" event is fired since the transaction result cannot be determined from the HTTP response headers.

Regards,
Thomas

Alessandro Vernet

  • Username: avernet
  • Joined: Tue Mar 24, 2009 6:36 pm
  • Posts: 14
  • Twitter: avernet
  • GitHub: avernet
  • Gists: avernet
  • Offline
  • Profile

Re: Connection Manager: file upload failure function not cal

Post Posted: Fri Jan 07, 2011 10:51 am
+0-
Hi Thomas,

Thank you for looking into this. I tried to register a listener on the "complete" event: my handler is called when the upload succeeds, but it isn't when the upload fails because of a connectivity issue. You can reproduce this with the example linked below. Select a small file, and click on "Send". It will send it to a page that waits 10 seconds. After about 10 seconds, you'll get alerts for "Complete" and "Success" (upload handler). So far so good. Now do the same, but while the file is uploaded, cut the connection while the upload is in progress (on Windows, I do this by disabling the connection in Network Connections). Uploading will stop right away, but no handler is called.

http://www.scdi.org/~avernet/try/yui-upload

You can reproduce this with Chrome and IE. With Firefox, I am not sure why, but when submitting the form the whole page is reloaded, not just the iframe. The JavaScript code is inline in the HTML of the page.

Alex

Alessandro Vernet

  • Username: avernet
  • Joined: Tue Mar 24, 2009 6:36 pm
  • Posts: 14
  • Twitter: avernet
  • GitHub: avernet
  • Gists: avernet
  • Offline
  • Profile

Re: Connection Manager: file upload failure function not cal

Post Posted: Mon Jan 10, 2011 10:25 am
+0-
Does anyone have an idea on this one? If a form POST, or in general a page load, is interrupted because of a connection issue, is it even possible to know that this happened in JavaScript?

Alex
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum