使用 uploadify 时出现 HTTP 错误 302
我使用 uploadify 将文件上传到我的网站。
它与一家托管公司合作。并且不与其他公司(sweb.ru)合作。
错误是:HTTP 错误:302。
有谁知道如何解决此问题。谢谢。
I use uploadify to upload files into my web site.
It works with one hosting company. And doesn't with other company (sweb.ru).
Error is: HTTP error: 302.
Does Anybody know how to resolve this problem. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
对于在 Uploadify 和 PHP 框架(例如 CodeIgniter、CakePHP、Kohana、Yii 等)方面遇到此问题的任何人:
Flash 不会传递您现有的 PHP 会话信息,因此,如果您收到 302 错误,则可能是您的应用程序正在将登录 URL 返回到 Flash 播放器。要解决此问题,您可以将会话信息包含在 scriptData 中,并在应用程序中手动管理它。
For anyone having this problem with Uploadify and a PHP Framework (e.g., CodeIgniter, CakePHP, Kohana, Yii, etc.):
Flash will not pass through your existing PHP Session information, so if you are getting the 302 error it is likely that your application is returning the login URL to the Flash player. To resolve this issue, you could include the session information in scriptData and manage it manually in your application.
通过在 htaccess 中添加“SecFilterEngine Off”解决了问题
Problem was solved by adding "SecFilterEngine Off" in htaccess
请记住,您可能必须停止重定向。
我正在使用cakephp。
要在调用 uploadify / ajax 方法时停止触发身份验证,您必须将以下内容添加到控制器中。
在我看来,“admin_attach”是 uploadify 调用的方法。
Remember that you may have to stop the redirect.
I'm using cakephp.
To stop the auth from triggering when the uploadify / ajax method is called you have to add the following to the controller.
"admin_attach" is the method that is called by uploadify in my view.
如前所述,
302
是重定向状态代码,因此可能会在沿线的某个位置发生重定向。您可能需要询问托管公司。我的第一个怀疑是您要发布到已激活转发的域,例如
domain.com
=>www.domain.com
。As said,
302
is a redirect status code, so there is probably a redirection taking place somewhere along the line.You may have to ask the hosting company. My first suspicion would be that you're posting to a domain that has forwarding activated, e.g.
domain.com
=>www.domain.com
.在入口脚本的开头尝试这个:
然后会话组件将像往常一样从 cookie 中读取正确的会话 ID。
我从 Yii-framework 论坛得到这个
Try this in the beginning of the entry-script:
The session component will then read the correct session id from the cookie as usual.
i got this from Yii-framework forum
刚刚从事的一个项目遇到了这个问题。我有一个个人资料图像想要更新,但在 Firefox 中继续收到此错误。我很快意识到 uploadify 试图覆盖的原始图像是通过 FTP 作为与公共 Web 服务用户不同的用户上传的。即使将权限设置为 777,302 错误仍然会发生。
我通过 FTP 删除了图像并让网络用户上传新的图像。然后我能够覆盖图像,消除收到的 302 错误。
Just worked on a project that had this problem. I had a profile image which I wanted to update, but continued to receive this error in Firefox. I soon realized that the original images that uploadify was trying to overwrite were uploaded via FTP as a different user than the public web service user. Even when permissions were set to 777, that 302 error continued to occur.
I removed the images via FTP and let the web user upload the fresh ones. Then I was able to overwrite the images, cancelling out the 302 error I was receiving.
对于那些使用 Kohana PHP 框架并努力让 Uploadify 与会话一起工作的人,这里有一个关于如何让它发挥良好作用的快速文章:
http://www.serializethis.com/using-uploadify-and-kohana-没有-http-error-302/
For those using the Kohana PHP framework who are struggling to get Uploadify to work with sessions, here's a quick writeup on how to make it play nice:
http://www.serializethis.com/using-uploadify-and-kohana-without-http-error-302/