Rob Gonda's Blog

FileReference onComplete is not fired on Mac OS

We are launching tomorrow a project that requires Flash to upload a file to a server, which is usually done through the FireReference class... Strangely, it works everywhere except on a Mac OS. We tested on OSX with Firefox and Safari, getting identical results: the file would upload, but the onComplete call would never get triggered.

The server environment for this particular project was php4 and amfphp for all remoting calls. After reading a couple of blogs, it seems like there's a Flash-side solution by using uploadCompleteData, which only works with ActionScript 3. Our project was developed with ActionScript 2, so I kept looking. Then I found that if php (or any server-side language) returns a space it should work ... nothing yet .... then I found that someone got it to work returning a "1", and indeed, echo "1"; fixed it for all environments... finally working on Windows, IE, FF, Mac, FF, Safari ...

So now you know, if you use the Flash FileReference class, make sure to always return a string so Mac OS knows the file finished uploading.

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?AE62B238-EA65-D66D-3496C8495CCD3D0B

Comments
I wonder if this has something to do with the fact that they added the DataEvent.UPLOAD_COMPLETE_DATA event type to the file reference class in flash player 9.0.45

You should probably file a bug report about this one
# Posted By Tony Fendall | 7/10/07 12:54 AM
@Tony, I doubt it's related, since it's been a known bug since Flash 8, and wasn't fixed with the Flash 9 release. I'm sure there's an open bug for this, but if not, I will definitely file one.
# Posted By Rob Gonda | 7/10/07 1:07 AM
Abdul Qabiz posted about this issue a while ago as well:
http://www.abdulqabiz.com/blog/archives/flash_and_...
# Posted By Arul Prasad | 7/10/07 1:27 AM
Yep, the solution is to have an
echo "ok";
as a response in the php script.
# Posted By cosmin | 7/10/07 6:39 AM
This blog is running version 5.9.003. Contact Blog Owner