Note that there are some explanatory texts on larger screens.

plurals
  1. POAS3 SecurityError #2048 Mac vs Windows
    text
    copied!<p>I seem to be running into an interesting problem while saving a Sprite to my server. When I run the swf (remote) on my MAC it works fine but when I run the exact same URL from my windows computer I get a #2048 SecurityError. </p> <p>Here my AS3 code:</p> <pre><code> public function saveSprite(s:Sprite):void { var bmpData:BitmapData = new BitmapData(s.width, s.height, true, 0xFFFFFF); bmpData.draw(s); var byteArray:ByteArray = PNGEncoder.encode(bmpData); var encodedFile:Base64Encoder = new Base64Encoder(); encodedFile.encodeBytes(byteArray); var data:URLVariables = new URLVariables(); data.fileData = encodedFile; data.fileName = "test.png"; data.location = "temp/"; var request:URLRequest = new URLRequest(scriptLocation); request.method = URLRequestMethod.POST; request.data = data; var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, errorLog); loader.addEventListener(Event.OPEN, errorLog); loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, errorLog); loader.addEventListener(IOErrorEvent.IO_ERROR, errorLog); loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, errorLog); loader.addEventListener(ProgressEvent.PROGRESS, errorLog) try { loader.load(request); } catch (e:*) { debug.updateLog(e + "\n"); } } private function errorLog(e:*):void { debug.updateLog(e + "\n"); } </code></pre> <p>The AS3 connects with the following one-line PHP-file:</p> <pre><code>&lt;?php file_put_contents($_POST['location'] . $_POST['fileName'], base64_decode($_POST['fileData'])); </code></pre> <p>When I run the SWF on my mac the output is as follows: Log Start [Event type="open" bubbles=false cancelable=false eventPhase=2] [ProgressEvent type="progress" bubbles=false cancelable=false eventPhase=2 bytesLoaded=7 bytesTotal=0] [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=200 responseURL=null] [Event type="complete" bubbles=false cancelable=false eventPhase=2]</p> <p>Where on a Windows I get the following output: Log Start [HTTPStatusEvent type="httpStatus" bubbles=false cancelable=false eventPhase=2 status=0 responseURL=null] [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]</p> <p>Any thoughts on this will be appreciated. My own guess would be something with file permissions but what?</p> <p>Thanks in advance!</p> <p>[EDIT] It gets more interesting. 1. When I move my whole project to a different server I get a #2048 on windows and mac. 2. If I change my file permissions to 777 I get a #2048 on windows and mac as well.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload