# Can't access php file when uploading the swf to ftp

**URL:** <https://forum.kirupa.com/t/cant-access-php-file-when-uploading-the-swf-to-ftp/327924>\
**Category:** Uncategorized\
**Created:** [April 6, 2012, 2:25am UTC](https://forum.kirupa.com/t/cant-access-php-file-when-uploading-the-swf-to-ftp/327924 "2012-04-06T02:25:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Soder](https://avatars.discourse-cdn.com/v4/letter/s/f08c70/32.png) [@Sebastian\_Soder](https://forum.kirupa.com/u/Sebastian_Soder)\
**Post date:** [April 6, 2012, 2:25am UTC](https://forum.kirupa.com/t/cant-access-php-file-when-uploading-the-swf-to-ftp/327924/1 "2012-04-06T02:25:28Z")

</div>

[LEFT][COLOR=#444444][FONT=Tahoma]I’m using this lines of codes to access a php file and to determine where to save my image[/FONT][/COLOR][/LEFT]  
loadingsign.visible=falsevar scriptURL=“[http://test.mysite.com/flash/saveIMG/](http://test.mysite.com/flash/saveIMG/)”; //absolute path to directory containing savePNG.php on your servervar savePath=“testIMAGE”; // save filename excluding .png file extension (relative path from scriptURL)var scriptName=“savePNG.php” [LEFT][COLOR=#444444][FONT=Tahoma]It works god when I’m in flash but it won’t work when I upload it to a server, I have come to understand that it has something to do with flash sandbox security problems but I have no idea how to fix it, I have tried to write a relative path like ” saveIMG/ ” (if the flash would be in the flash folder)[/FONT][/COLOR][COLOR=#444444][FONT=Tahoma]Someone that has any idea how to fix it??[/FONT][/COLOR][COLOR=#444444][FONT=Tahoma]and here is the code as whole[/FONT][/COLOR][/LEFT]  
import com.adobe.images.JPGEncoder;import nl.stroep.utils._;import com.gskinner.utils.SWFBridgeAS3;//SETUP::::::::::::::::loadingsign.visible=falsevar scriptURL=“[http://test.mysite.com/flash/saveIMG/](http://test.mysite.com/flash/saveIMG/)”; //absolute path to directory containing savePNG.php on your servervar savePath=“testIMAGE”; // save filename excluding .png file extension (relative path from scriptURL)var scriptName=“savePNG.php” ////////////////////////_//WHEN THE CONNECTION IS ESTABLISHED: (optional)myBridge.addEventListener(Event.CONNECT, handleConnect);function handleConnect(event:Event){ //setupSWF is an example how to call an AS2 custom function: myBridge.send(“setupSWF”,“parameter1”);};\*///PRINT BUTTON ACTION:goBTN.addEventListener(MouseEvent.MOUSE\_UP, goBTNclick);function goBTNclick(event:Event){ loadingsign.visible=true goPrint(22,22,702,500)}//CREATE AND EXPORT THE JPGS TO PHP:function goPrint(X:Number,Y:Number,W:Number,H:Number){ var thecrop = crop( stage,W,H,X,Y); var imageSaver:ImageSaver = new ImageSaver( scriptURL+scriptName ); imageSaver.save ( thecrop, savePath ); imageSaver.addEventListener ( Event.COMPLETE,onSaveComplete) imageSaver.addEventListener ( IOErrorEvent.IO\_ERROR, onSaveError ); trace(‘PRINTING: ‘+X+’, ‘+Y+’, ‘+W+’, ‘+H+" to:  
"+scriptURL+savePath+’.png’);}function onSaveComplete(e){ trace(‘SAVE COMPLETE’) loadingsign.visible=false}function onSaveError(e){ trace(‘ERROR WITH SAVE’) loadingsign.visible=false}///////////////////////FUNCTIONS::::::::::function crop( inDisplayObject:DisplayObject, inWidth:Number = 550, inHeight:Number = 400, inX:Number = 0, inY:Number = 0, inScale:Number = 1):Bitmap{ if (!inDisplayObject) { throw new Error(‘CropUtil.crop \> needs a something on the display list’); return null; } var cropArea:Rectangle = new Rectangle( 0, 0, inWidth \* inScale, inHeight \* inScale); var croppedBitmap:Bitmap = new Bitmap( new BitmapData( inWidth \* inScale, inHeight \* inScale), PixelSnapping.ALWAYS, true ); croppedBitmap.bitmapData.draw( inDisplayObject, new Matrix(inScale, 0, 0, inScale, -inX, -inY), null, null, cropArea, true ); return croppedBitmap;}stop();
