Here’s what I am trying to accomplish. I have a BitmapData that I am sending to a PHP function as ByteArray on the server by using URLRequest. The PHP function then saves the ByteArray as a jpg. All is well, so far and I am able to save the image on the server. Where I am stuck is that the PHP function generates the image file name randomly and I have no clue on how to get the name of the file I have just saved on the server. I am using the below code to send byteArray to the PHP function. How to modify/add this so I can get the filename of the image once it’s saved on the server?
var myHeader:URLRequestHeader = new URLRequestHeader("Content-type","application/octet-stream");
var myReqst:URLRequest = new URLRequest(path);
myReqst.requestHeaders.push(myHeader);
myReqst.method = URLRequestMethod.POST;
myReqst.data = imageBytes;
var myLoader:URLLoader;
myLoader = new URLLoader();
myLoader.load(sendReq);
If you’re using URLLoader (which I normally don’t, HTTPService is better IMO), you can listen for the ‘complete’ even to the triggered, which you can then check the ‘data’ property on URLLoader for the filename returned by the php function (as long as php actually returns it).