I have a sketch pad made in Flash AS3 like this one here: http://henryjones.us/articles/using-the-as3-jpeg-encoder
I want to send the jpg to the server and some data from a html form field with php. Is there a way to force the Flash movie to deliver the image file when one presses the submit button?
You can use a HTTPService to send data. Here's a tutorial sort introduction.
it's a little tricky: You can do it one of two ways:
Arthem posted this in another thread:
And I usually use this solution:
I haven't used the imageshack API, but you may want to try using adobe's JPGEncoder class - here's a quick example that passes a username and the JPG's byte array, it's really quite simple.
Note that the variables are passed as part of the query string. You can't use URLVariables, as several people have suggested, as the URLVariables would be stored in the request's data property, which we are already using to pass the byteArray.
You can use AMFPHP or Zend AMF, I just finished a project like this, my product allow a user to change a product color scheme and then output the ByteArray data and other AS3 object directly to PHP, and insert into MySQL, you can see my project and AMFPHP
all PNG transparent images are generated by Flash, and send to AMFPHP, PHP then generate the PNG file on the server.
I wanted to send an encrypted authorization code form Flash to PHP along with a JPG image. It was not suitable to post this in the get variables and so I got around it this way. Most of the code is the actual gathering of a stage snapshot, but only a specific region of it. The part that is relevant to here is the use of writeMultiByte to tack on the encrypted password to the end of the jpb image info. I then send the length of this password using the get variables url string so that PHP know show much to chop off the end.
The receiving PHP:
If you're not using flex, try URLLoader && URLrequest, to pass your data as a POST variable.