I got the answer from this web post:

http://stackoverflow.com/questions/1270347/unexpected-flash-security-exception-when-using-urlloader

Instead of setting the contentType like this:

request.contentType = "multipart/form-data;boundary=" + 
POSTUploadBuilder.boundary;

Set the contentType like this:

request.requestHeaders.push(new URLRequestHeader('Content-Type', 
'multipart/form-data; boundary=' + POSTUploadBuilder.boundary));

This is how I create the boundry in my POSTUploadBuilder class:

    public class POSTUploadBuilder {
        private static var _boundary:String = "";
        private static var _mainBoundary:String = "";
        
        public static function get boundary():String {
            if(_boundary.length == 0) {
                var i:uint = 0;
                var len:uint = 0x20;
                
                for(; i < len; ++i) {
                    _boundary += String.fromCharCode(uint(97 + Math.random() * 
25));
                }
            }
            
            return _boundary;
        }


--- In flexcoders@yahoogroups.com, "greg_lafrance" <glafrance@...> wrote:
>
> I'm running within Flash Builder, to be able to set and hit breakpoints. How 
> can I do this and not run from file://  ?
> 
> Its strange that this is happening only for this one module. What could be 
> making a difference?
> 
> --- In flexcoders@yahoogroups.com, Alex Harui <aharui@> wrote:
> >
> > Use a testing server, don't run from file://
> > 
> > 
> > On 2/2/12 9:45 AM, "Greg Lafrance" <glafrance@> wrote:
> > 
> > 
> > 
> > 
> > 
> > 
> > Our app has a "main" module with link button, and clicking each link button 
> > loads different modules in the main content area.
> > 
> > For only one module, we get a Security Sandbox Violation when we try to do 
> > a multipart post of image data.
> > 
> > I can't find anything significantly different about this module, other 
> > modules do multipart posts fine.
> > 
> > I have added thre SWF and various folders (such as containing folder, its 
> > parent, etc.) to flash player global settings, but no luck. We added a 
> > liberal cross domain file but still no luck.
> > 
> > BTW, we are using ModuleLoader, should we try ModuleManager?
> > 
> > Please help.
> > 
> > *** Security Sandbox Violation ***
> > Connection to
> > http://localhost:PORTNUMBERHIDDEN/services/rest/mycompany/222/assetservice/asset?action=saveasset&objecttype=serviceOffer&objectid=5960&User-Agent=flex3.0&randomNum=1328144876976
> > 
> > halted - not permitted from
> > 
> > file:///C:/Perforce/Main/Portal/main/bin-debug/serviceOffer-2.4.0.18-SNAPSHOT.swf
> > 
> > 
> > 
> > 
> > 
> > 
> > --
> > Alex Harui
> > Flex SDK Team
> > Adobe Systems, Inc.
> > http://blogs.adobe.com/aharui
> >
>


Reply via email to