I have a few questions about the process of sending an image file to PHP from a client application, in my case a flash Application.
My Goal:
I want to send an image file to my php script as well as a small handful of other parameters that are used for verification purpose. In the php file, I want to be able to verify that all the bytes were received in tact and no errors.
1. What header do I use for this POST?
Even if you do not know Actionscript 3 programming you can easily make out my AS3 code below.
import com.adobe.images.JPGEncoder;
var jpgSource:BitmapData = new BitmapData (sketch_mc.width, sketch_mc.height);
jpgSource.draw(sketch_mc);
var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest("jpg_encoder_download.php?name=sketch.jpg");
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
navigateToURL(jpgURLRequest, "_blank");
So currently, I am sending the name/value pairs that will be used for verification in the URL and as you can see. I'm posting the jpgStream. Perhaps I should first calculate a CRC or something and then send that as a URL Parameter and then in PHP recalculate the CRC to see if it was received in tact? (not quite sure if that's how to verify the image was received intact)
Am I using the right header here, perhaps I should use a different one more relevant to this page??? http://www.php.net/manual/en/features.file-upload.post-method.php
Any help on this, greatly appreciated