您的位置:首页 > 产品设计 > UI/UE

FileReference URLrequest上传文件的问题:Session丢失

2012-12-03 15:15 513 查看
FileReference使用的URLRequest和Flash所在页面用的不同的Session. 所以即使你已经登录,由于上传的请求用的是不同的Session,服务器无法得知请求已经验证。 Adobe文档如此解释

The FileReference and FileReferenceList classes also do not providemethods for authentication. With servers that require authentication,you can download files with the Flash® Player browserplug-in, but uploading (on all players) and downloading (on thestand-alone
or external player) fails. Listen for FileReference eventsto determine whether operations complete successfully and to handleerrors.

翻译过来就是 FileReference 不支持验证功能。

解决方法

1. 不使用FileReference,而使用form post上传文件。这样和普通的Html页面一样了。

2. 将Session id传到服务器。 如果你使用的Server是TomCat/JSP 可以如下添加SessionID. var request:URLRequest = new URL Request("http://www.[your url].com" ";jsessionid=" _yoursessionid); 3. 不验证Session,而检查上传ID。比如每次上传前,服务器生成一个ID,上传的时候把这个传ID作为URLRequest的参数传过去。

4. 将需要验证的用户名密码,添加至URLRequest的参数,在服务器端进行验证,然后在服务器端,将用户信息存入session,这样,只要flex页面session不变,下次提交请求时,服务器端的session就是保存用户信息的session。

5. 等待adobe发布hotfix.

参考:
http://bbs.airia.cn/FLEX/thread-732-1-1.html http://www.thanksmister.com/index.php/archive/firefox-flex-urlrequest-and-sessions-issue/ http://www.forta.com/blog/index.cfm/2006/9/24/flex-and-session-state-management
来源:sina Blog
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐