Enregistrer l'image de Flash, l'envoyer à PHP et de retourner une chaîne d'URL Flash

J'utilise ce code pour convertir une image en un BitmapData et de stocker un JPG dans un objet ByteArray.

import com.adobe.images.JPGEncoder;

var jpgSource:BitmapData = new BitmapData (img_mc.width, img_mc.height);
jpgSource.draw(img_mc);

var jpgEncoder:JPGEncoder = new JPGEncoder(85);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);

//here we need some code to send the bytearray but I lack enough knowledge to do it by myself

Maintenant, je veux faire ce qui suit:
1. envoyer l'objet ByteArray de PHP;
2. PHP doit magasin physique image_id.jpg sur le serveur;
3. puis PHP doit retourner l'URL de l'image de Flash;

Est-ce possible? Comment?

Les premières lignes de PHP peut être:

if (isset($GLOBALS["HTTP_RAW_POST_DATA"]))
{
    //get bytearray
    $jpg = $GLOBALS["HTTP_RAW_POST_DATA"];

    //but I don't know how to save the image on disk and how to return the URL of the //image
}

Merci!

InformationsquelleAutor Lotus | 2011-05-20