Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 06-01-2010, 08:55 AM   #1
vdLoo88
Member
 
Join Date: Apr 2009
Posts: 58
Default Error #2048: Security sandbox violation

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
vdLoo88 is offline   Reply With Quote
Old 06-01-2010, 09:52 AM   #2
henke37
Senior Member
 
henke37's Avatar
 
Join Date: Mar 2009
Location: Sweden
Posts: 10,909
Send a message via Skype™ to henke37
Default

The ip addresses differ. Make them not do that.
__________________
Signature: I wrote a pair of articles about the timeline.
henke37 is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:41 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.