Firefox中使用FileReference上传文件的问题:Session丢失
2010-06-23 16:13
579 查看
在Flex中使用FileReference上传文件的时候,遇到了一个很怪的问题。文件上传在IE中一切正常,而在Firefox中总是失败。Debug后发现,firefox中上传文件时,请求总是没有验证。用google一把,发现原因是: Firefox中,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. 等待adobe发布hotfix. 有人知道怎么在Asp.net中把Session ID和URL一起传到服务器,而且服务器使用这个SessionID表示的Session吗? 我没有找到答案。
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. 等待adobe发布hotfix. 有人知道怎么在Asp.net中把Session ID和URL一起传到服务器,而且服务器使用这个SessionID表示的Session吗? 我没有找到答案。
相关文章推荐
- 解决使用FireFox下Flash上传文件时SESSION丢失的问题(swfupload)
- FileReference URLrequest上传文件的问题:Session丢失
- Flash:使用FileReference上传在Firefox上遇到的问题终于解决了
- 后台使用Spring MVC 4.15 版本 通过 ajaxFileUpload plugin插件上传文件相应时引起的一个小问题,Chrome、Firefox中出现SyntaxError:unexpected token <
- 解决HttpClient的FilePart上传文件中使用中文名称文件名乱码问题
- Linux解决问题篇——ftp上传文件(使用put)时,permission denied,下载文件(使用get)时,failed to open file
- 使用EasyUI 的上传文件控件 easyui-filebox 获取其数据的问题
- 解决使用elementUI框架el-upload上传组件时session丢失问题
- Flex与.NET互操作 使用FileReference+HttpHandler实现文件上传/下载
- file文件添加change事件,结合ajaxFileUpload使用文件上传只生效一次问题解决
- Flex用filereference上传文件firefox下报2038错误
- 使用FileReference+HttpHandler实现文件上传/下载(Flex与.NET互操作)
- 对于ASP.net 2.0上传文件后session丢失问题的解决方案
- Flex与.NET互操作(五):使用FileReference+HttpHandler实现文件上传/下载
- flex使用filereference+httphandler实现文件上传/下载(转)
- Flex与.NET互操作(五):使用FileReference+HttpHandler实现文件上传/下载
- 上传文件中使用ajaxfileupload.js碰到的问题
- lamp使用php处理上传文件,调用move_uploaded_file函数遇到目录写权限问题及解决过程
- 解决美化后的文件上传控件(type=file),IE和firefox不兼容的问题
- 使用TP上传类,一个表单多个file上传丢失部分文件