Hello,
Before I start, I have read this thread:
http://www.actionscript.org/forums/s...=Error+%232048
But I think my problem is a bit different:
I have a flash file, that sends data to a php script. This script then saves a jpg on the server.
PHP Code:
Code:
<?php
$absolutepath = dirname(__FILE__);
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] ))
{
$im = $GLOBALS["HTTP_RAW_POST_DATA"];
$filename = $_GET['name'];
$fullFilePath=$absolutepath."/".$filename;
$handle=fopen($fullFilePath,"w");
fwrite($handle,$im);
fclose($handle);
}
else echo 'An error occured.';
?>
AS Code
Code:
var serverPath:String = "http://127.0.0.1/my_project/public/actionscript/";
function createJPG(fileName:String="snapshot.jpg")
{
serverUniqueFileName=fileName;
var jpgSource:BitmapData = new BitmapData (600,600);
jpgSource.draw(stage);
var jpgEncoder:JPGEncoder = new JPGEncoder(100);
var jpgStream:ByteArray = jpgEncoder.encode(jpgSource);
var header:URLRequestHeader = new URLRequestHeader ("Content-type", "application/octet-stream");
var jpgURLRequest:URLRequest = new URLRequest (serverPath+"jpg_encoder.php?name=" + fileName);
jpgURLRequest.requestHeaders.push(header);
jpgURLRequest.method = URLRequestMethod.POST;
jpgURLRequest.data = jpgStream;
var jpgURLLoader:URLLoader = new URLLoader();
//jpgURLLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
jpgURLLoader.load( jpgURLRequest );
}
Both the php and the swf file is located in /my_project/public/actionscript/
I am using WampServer and when I run it through localhost, everything works fine and the php writes the file. However, if I put WampServer online, and access my project through the network, flash gives me this error:
192.168.0.201 is the localhost IP.
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation:
http://192.168.0.201/my_project/publ...cript/test.swf cannot load data from
http://127.0.0.1/my_project/public/a...e=snapshot.jpg.
at test_fla::MainTimeline/createJPG().
Could you please help me and give me some advice? Does this have something to do with the crossdomain.xml file from the other thread. Or is it WampServer that is preventing me from writing files?
Thanks,
Cheers