[AS2]FileRef upload response to Flash

Here’s my dilemma, how can I catch a response from the PHP script I use to upload files?

So the code is this:

var uploaded:Boolean = fileRef.upload(uploadScript);
fileListener.onComplete = function(file:FileReference):Void {
    _root.loadImage(...blabla...);
}
fileRef.addListener(fileListener);

Right! The problem, however, is that I don’t want to load the image onComplete. I want to load the image when my PHP script says I can. That’s because my PHP script also resizes the image before saving to the server, so the image is not saved on the server when Flash receives the onComplete.

Does anyone have any idea how I can handle this?

Thanks.