Error 2000 when uploading

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Bathory
Posts: 54
Joined: 17 Sep 2011, 21:47

Error 2000 when uploading

Postby Bathory » 08 Oct 2014, 01:32

Hello guys,

I get this error

SecurityError: #2000 No active security context

in Flash when trying to upload an image file on the server.

Here is the code:

Code: Select all

private function someButtonClick(evt: MouseEvent):void {
         
    _loadFile = new FileReference();
    _loadFile.addEventListener(Event.SELECT,uploadSelectHandler);
     var fileFilter:FileFilter = new FileFilter("Images: (*.jpeg, *.jpg, *.gif, *.png)", "*.jpeg; *.jpg; *.gif; *.png");
    _loadFile.browse([fileFilter]);
}
      
private function uploadSelectHandler(event:Event):void
{
   _loadFile.removeEventListener(Event.SELECT, uploadSelectHandler);
         
   trace("uploadSelectHandler " + _loadFile.name); //displays the correct file name
         
   var req:URLRequest = new URLRequest(rD.sF.httpUploadURI);
   req.method = URLRequestMethod.POST;
                     
   _loadFile.upload(req); //throws error #2000
}


Some info that I hope will help:

- _loadFile has the correct file name once loaded and I can display its content in a sprite without problem
- I'm testing this locally on Windows XP
- server version is 2.9.0 and client version 1.2.5
- Upload files is enabled in the Zone configurator
- So is the Web server, HTTP enabled and HTTP port is 8080
- FILE_UPLOAD event handler is defined on the server and of course is never fired
- Crossdomain.xml accepts everything (*)
- I use Flash CS5.5
- Local playback security is "Access network only" but I get the same error with "Access local files only"
- It doesn't work whether I'm inside Flash or a browser (I don't know if it technically throws the same error when inside a browser)

Any ideas?

Thanks 8)
Bathory
Posts: 54
Joined: 17 Sep 2011, 21:47

Re: Error 2000 when uploading

Postby Bathory » 08 Oct 2014, 03:51

More details...

If I add a IOErrorEvent listener on the fileref before uploading, then I won't get error 2000 but instead error 2038 which is a generic I/O error (with URL being http://127.0.0.1:8080/BlueBox/SFS2xFile ... ashId=.....)

I can prevent any error from occuring by calling _loadFile.cancel() before the upload, but the file is still not successfully uploaded (FILE_UPLOAD not fired on server side and nothing appears in the SFS2x/data/uploads folder).

If I add a progress event handler I will get one or more of these events until the bytesLoaded is equal to the file size total.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Error 2000 when uploading

Postby Bax » 08 Oct 2014, 08:35

What if you try to upload the same file to the server using the extension uploading module in the Admin Tool? Do you get the same error?
Paolo Bax
The SmartFoxServer Team
Bathory
Posts: 54
Joined: 17 Sep 2011, 21:47

Re: Error 2000 when uploading

Postby Bathory » 08 Oct 2014, 19:30

Yes : "Upload failed due to I/O error" and the details tell me to check my config.

I tried to upload many different file types from many directories, the error is the same.

Everything under the Web server tab of the server configuration is enabled. But I recently upgraded SFS2x from 2.6 to 2.9, maybe I did something wrong during the installation process. I don't remember moving any files or doing anything special though.

Btw there's no hurry to find a solution to this, as I decided to simply transfer images via bytearray using a JPGEncoder.

Thanks
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Error 2000 when uploading

Postby Bax » 10 Oct 2014, 08:26

I'm out of ideas... your setup seems to be correct, and in our tests with a similar setup the uploading works. In particular we don't have issues in the Admin Tool.
Anyway I'm glad you could an alternative way.
Paolo Bax
The SmartFoxServer Team
Bathory
Posts: 54
Joined: 17 Sep 2011, 21:47

Re: Error 2000 when uploading

Postby Bathory » 10 Oct 2014, 16:33

No problem, thank you for your time. If I find anything new I will post it.

Return to “SFS2X ActionScript 3 API”

Who is online

Users browsing this forum: No registered users and 21 guests