Flex 4 FileReference 与 Firefox 的问题
我正在尝试使用在 Firefox 4 中运行的 Flex 应用程序中的 FileReference 执行文件上传。但是,当我尝试调用 upload() 方法时,Filereference 会抛出 IOError 并显示以下内容
Error #2038: File I/O Error. URL: http://localhost:8080/admin/upload
如果我没有显式添加侦听器对于 IOErrorEvent,然后我得到一个 Flash 播放器弹出窗口,指出
SecurityError: Error #2000: No active security context.
请求甚至没有到达我的服务器(我可以通过在 Java 代码中放置断点并观察使用 HTTPFox 发出的 HTTP 请求来验证),所以看起来我认为这是客户端问题(对吗?)。我已经在谷歌上搜索了这个问题,建议包括将 upload() 调用包装在 timeout/callLater 中,并尝试将 sessionId 附加到请求中(因为 Firefox 为上传创建了一个新线程,并且不这样做)附加适当的cookie)。这些方法对我来说都不起作用。
我在使用 Internet Explorer 时没有遇到此问题,仅在 Firefox 中遇到过此问题。
以前有人遇到过这种情况吗?有什么建议吗?感谢您的任何帮助。
编辑: 应该提及的是,SWF 和所请求的 URL 位于同一服务器上 (localhost:8080)。
I'm trying to perform a file upload using a FileReference from a Flex app running in Firefox 4. However when I attempt to call the upload() method, the Filereference throws an IOError with the following
Error #2038: File I/O Error. URL: http://localhost:8080/admin/upload
If I don't explicitly add a listener for the IOErrorEvent, then I get a Flash player popup stating
SecurityError: Error #2000: No active security context.
The request doens't even hit my server (I can verify by placing breakpoints in the Java code and watching the HTTP Requests that go out using HTTPFox), so it seems to me that this is a client side issue (right?). I've done some searching for the problem on google and the suggestions included wrapping the upload() call in a timeout/callLater, and attempting to attach the sessionId to the request (since Firefox creates a new thread for the upload and doesn't attach the proper cookies). Neither of these approaches has worked for me.
I don't experience this problem with Internet Explorer, only Firefox.
Has anyone encountered this before? Any suggestions? Thanks for any help.
EDIT: Should mention that the SWF and the URL being requested are on the same server (localhost:8080).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 FileReference 的文档中:
另外 - 这是作为版本运行还是在调试器中运行?有时,服务器访问的行为完全不同。
From the docs for FileReference:
Also - is this running as release or in the debugger? Sometimes the behavior for server access is quite different.
相当正常的安全沙箱问题(在 Firefox 中并不普遍,但在 Flash Player 中普遍存在)。
您只需要在网络服务器的根目录中有一个 crossdomain 文件。
Fairly normal security sandbox issue (not prevalent to Firefox, but to Flash Player).
You just need a crossdomain file on the root of your webserver.