Linux Flash Player Bugs

As a user of Linux on the desktop (I use Ubuntu 7 on an HP nc8430 laptop), the release of a current version of the Flash Player for Linux was great news. As well as allowing me to look at the latest Flash web sites, it allowed me to develop and test content produced using the Flex SDK. Unfortunately there are a couple of annoying bugs in the player related to use of the FileReference class – the class that lets you upload files back to the server.

The first of these bugs relates to sending parameters back to the server at the same time as uploading the file. This is useful as it lets the page send back information that the user may have entered to be associated with the file, such as a title and description for the file. Normally you use the URLVariables class to add variables to the file, for example:

var fileRef:FileReference = new FileReference();
// In handler for Event.SELECT
var params:URLVariables = new URLVariables();
params.title = "Sleeping Cat";
params.description = "My cat having a sleep on the patio.";
var request:URLRequest = new URLRequest("http://localhost:8080/FileUploadServlet");
request.method = URLRequestMethod.POST; = params;

Now under Flash Player in Windows this works just fine – the parameters are encoded into the request and uploaded just as Adobe says they should be. Try it under Linux though, and you just get the uploaded file – no parameters sent. This is very annoying as it means I have to encode the information I want to sent differently if I want to support Linux, which I do or otherwise I won’t be able to see my own application.

The workaround that I have implemented is to put the parameters into the URL itself, eg:

var requestString:String = "http://localhost:8080/FileUploadServlet?title=" + title \\
 + "&description=" + description;
var request:URLRequest = new URLRequest(requestString);

This works fine in both Linux and Windows, although you may have to encode your parameters of course before creating the URL to avoid illegal characters in there.

But unfortunately that is not the only problem with FileReference in the Flash Player. Adobe introduced an event to UPLOAD_COMPLETE_DATA that allows you to get at any response from the server once your file is uploaded. This allows you to make your server-side code send a response back to the player, for example a reference number or even XML with more complex data, for example:

fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, fileUploadCompleteDataHandler);

…and then…

private function fileUploadCompleteDataHandler(event:DataEvent) : void
{"File upload OK - response from server: " +, "Debug");

This all sounds great, but unfortunately it doesn’t work under Linux either – although its just fine under the Windows player.

I’ve reported both of these issues to Adobe, so I hope that they get resolved soon. Sadly though it does make life more complex because of course so many people will have older versions of the Flash player that are broken. Fortunately I suspect Linux users are more amenable to upgrading, and of course the majority of users have Windows or OS/X.