Jump to content

POST ActionScript JPG to PHP file


The Little Guy

Recommended Posts

I am sending a jpg from ActionScript as post data, and I am not sure if my php is wrong. The jpg is a string of data, but it isn't all getting put into the jpg file. I have written it to a txt file, and the output was about 6 characters. Will my PHP work?

 

The ActionScript:

private function saveImage(e:MouseEvent):void{
    byteArray = jpg.encode(bmd);
    //fileReference.save(byteArray, "Image.jpg");
        
    var request = new URLRequest("http://envne.com/process/saveImage.php");
    request.method = URLRequestMethod.POST
    var vars = new URLVariables();
    vars.img = byteArray;
    //vars.txt = 'hello!';
            
    request.data = vars;
    var loader = new URLLoader();
    loader.load(request);
            
    removeChild(bmp);
    save.visible = false;
    discard.visible = false;
    capture.visible = true;
}

 

The PHP:

<?php
$handle = fopen('test.jpg', 'w');
fwrite($handle, $_POST['img']);
fclose($handle);
?>

Link to comment
https://forums.phpfreaks.com/topic/221375-post-actionscript-jpg-to-php-file/
Share on other sites

I have gotten it to display more lines, but I can not view the image in the browser though...

 

ÿ6+ÿ4)ÿ4(ÿ4(ÿ<%"ÿ@*&ÿ:*ÿ;+ÿ8-ÿ9.ÿ:-ÿ:-ÿ=-ÿ=-ÿ?0ÿA2ÿ?0ÿA2ÿE/ ÿD.ÿA/!ÿC1#ÿ?2 ÿ@3!ÿ?4!ÿ@5"ÿ?4!ÿA6#ÿF6*ÿE5(ÿH5,ÿJ7.ÿH7+ÿI9,ÿH;-ÿI<.ÿI<.ÿL>0ÿQB.ÿVG3ÿUD.ÿUD.ÿTE1ÿWH4ÿ]J7ÿ`L:ÿ`J:ÿeN?ÿgOHÿlTLÿmXJÿt_QÿucUÿygXÿ|l]ÿ|l]ÿ‚ofÿ†siÿŽvlÿŒukÿ�zlÿ�zlÿ‹zrÿŒ{sÿ‰{rÿŒ}uÿ�}sÿ�~tÿŽ‚tÿŽ‚tÿ’ŽÿІwÿ‹~zÿ‹~zÿŒ}yÿ�€|ÿ‹‚uÿ‹‚uÿ‰ƒsÿ‰ƒsÿ‰ƒsÿ‰ƒsÿ‰‚uÿˆ�tÿŠ€tÿŠ€tÿŠ�rÿ‹‚sÿ�€nÿ–‰w󧖅󾬛ÿ×�«ÿìÖÀÿîںÿò޾ÿûçÇÿûçÇÿùäÀÿøâ¾ÿýç�ÿÿíÇÿüéÄÿýêÅÿýéÉÿûçÇÿ÷äÂÿõâ¿ÿþîÆÿÿôÌÿÿîËÿýìÉÿÿëÎÿÿëÎÿÿéÑÿÿéÑÿÿèÑÿÿç�ÿÿçËÿÿé�ÿÿéËÿÿë�ÿÿîËÿÿêÇÿÿìÄÿÿìÄÿÿì¹ÿÿð¾ÿÿôÉÿÿôÉÿÿó�ÿÿòÎÿÿó�ÿÿòÎÿÿï�ÿÿï�ÿÿï�ÿÿðÒÿÿòÎÿÿïËÿÿÿáÿÿÿãÿøêÃÿÞЩ�ÿ~kGÿlV@ÿ_J3ÿH7!ÿA0ÿ>-ÿ>-ÿ<+ÿ<+ÿ;+ÿ:*ÿ6(ÿ5&ÿ/#ÿ+ÿ%ÿ%ÿÿÿÿ"ÿ"ÿ#ÿ%ÿ$ÿ'	ÿ*
ÿ'
ÿ(ÿ*ÿ+ 
ÿ*!ÿ,#ÿ,#ÿ.%ÿ-'ÿ1+ÿ3-ÿ70 ÿ;2!ÿ>6$ÿC9&ÿH=*ÿL</ÿRB5ÿUH8ÿYK;ÿ[O8ÿ]Q:ÿ\S6ÿ`W;ÿa[;ÿe^>ÿocIÿocIÿudSÿweTÿxiXÿxiXÿwkQÿzoUÿyqOÿ{sQÿ~tNÿ|rLÿ�mMÿ�mMÿ~gJÿ�kNÿ{gPÿxeNÿ{gTÿ|hVÿ{gTÿyeSÿyfOÿxeNÿ}jQÿubIÿteQÿaR>ÿ81ÿ.&ÿÿÿÿ
ÿ

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.