views:

45

answers:

1

I connect to a .NET handler to upload an image using YAHOO.util.Connect.asyncRequest. The handler then throws an exception because the file is too big. When the exception is thrown, the request connection is immediately cut meaning that the javascript callback for asyncRequest is not called and the user is not notified that the image upload failed. Is there any way to detect that the connection has been broken?

Thank you!

A: 

Are you supplying a 'failure' field in the callback object you're giving the YUI object? See http://developer.yahoo.com/yui/connection/#async

I'm surprised the failure procedure is not being called in your error case. I'd file a bug with YUI. Also use Fiddler so you can watch and see exactly what is happening on the TCP stream.

As an alternative to asyncRequest that would a) Provide a better user experience (and especially if your users are uploading large files) b) May well handle your error situation better, check out the YUI uploaded widget.

Once you get it working, it does a very nice job. See http://developer.yahoo.com/yui/uploader/

Regards,

Larry

Larry K