Flaş actionscript tarafından POST sonra PHP örneği olarak GET değişkeni nasıl

0 Cevap php

Hi I'm working on actionscript, saving a raw image from camera then POST with save.php then I want save.php echo back the variable which is a file name that have just generated by save.php to actionscript see this line: var urlParameter:String = "images/test_01.php?img=" + "myfileURL"; navigateToURL(new URLRequest(urlParameter), "_blank");

Şimdiden teşekkürler

Bu AS3 kodu

function onSaveJPG(e:Event):void{
    var myEncoder:JPGEncoder = new JPGEncoder(100);
    var byteArray:ByteArray = myEncoder.encode(bitmapData);

    var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream");

    var saveJPG:URLRequest = new URLRequest("save.php");
    saveJPG.requestHeaders.push(header);
    saveJPG.method = URLRequestMethod.POST;
    saveJPG.data = byteArray;

    var urlLoader:URLLoader = new URLLoader();
    urlLoader.addEventListener(Event.COMPLETE, sendComplete);
    urlLoader.load(saveJPG);

    function sendComplete(event:Event):void{
        warn.visible = true;
        addChild(warn);
        warn.addEventListener(MouseEvent.MOUSE_DOWN, warnDown);
        warn.buttonMode = true;  
    } 


    function warnDown(e:MouseEvent):void{
        var urlParameter:String = "images/test_01.php?img=" + "myfileURL";
        navigateToURL(new URLRequest(urlParameter), "_blank");
        //  navigateToURL(new URLRequest("images/"), "_blank"); 
        //  +saveJPG:URLRequest 
        // navigateToURL(new URLRequest("images/test_01.php?img=+saveJPG:URLRequest"), "_blank");
        warn.visible = false;
    }

} // move onSave JPG
} close to here instead of after sendComplete

warn.visible = false;

Bu save.php olduğunu

<?php

if(isset($GLOBALS["HTTP_RAW_POST_DATA"])){ $jpg = $GLOBALS["HTTP_RAW_POST_DATA"]; $img = $GET["img"]; $filename = "images/poza". mktime(). ".jpg"; file_put_contents($filename, $jpg);

echo "thisPic=" . $filename; // echo $filename;

} else{ echo "Encoded JPEG information not received."; } ?>

0 Cevap