使用 uploadify 时出现 HTTP 错误 302

发布于 2024-10-11 00:36:44 字数 121 浏览 6 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

微凉 2024-10-18 00:36:44

对于在 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.

帅冕 2024-10-18 00:36:44

通过在 htaccess 中添加“SecFilterEngine Off”解决了问题

Problem was solved by adding "SecFilterEngine Off" in htaccess

御弟哥哥 2024-10-18 00:36:44

请记住,您可能必须停止重定向。
我正在使用cakephp。
要在调用 uploadify / ajax 方法时停止触发身份验证,您必须将以下内容添加到控制器中。

  public function beforeFilter()
    {
        parent::beforeFilter();

        $this->Auth->allowedActions = array('admin_attach');
    }

在我看来,“admin_attach”是 uploadify 调用的方法。

$(document).ready(function() {
  $('.image-attach').uploadify({
    'uploader'  : '/uploadify/uploadify.swf',
    'script'    : '/admin/featureds/featured_resources/attach/',
    'cancelImg' : '/uploadify/cancel.png',
    'buttonText' : 'Select image',
    'fileDataName' : 'uploadify',
    'auto'      : true,
   onComplete   : function(event, id, fileObj, resp, data){
                    alert(resp);
                 }
    });
});

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.

  public function beforeFilter()
    {
        parent::beforeFilter();

        $this->Auth->allowedActions = array('admin_attach');
    }

"admin_attach" is the method that is called by uploadify in my view.

$(document).ready(function() {
  $('.image-attach').uploadify({
    'uploader'  : '/uploadify/uploadify.swf',
    'script'    : '/admin/featureds/featured_resources/attach/',
    'cancelImg' : '/uploadify/cancel.png',
    'buttonText' : 'Select image',
    'fileDataName' : 'uploadify',
    'auto'      : true,
   onComplete   : function(event, id, fileObj, resp, data){
                    alert(resp);
                 }
    });
});
简单爱 2024-10-18 00:36:44

如前所述,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.

别闹i 2024-10-18 00:36:44

在入口脚本的开头尝试这个:

if (isset($_POST['PHPSESSID']))
{ 
$_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
}

然后会话组件将像往常一样从 cookie 中读取正确的会话 ID。

我从 Yii-framework 论坛得到这个

Try this in the beginning of the entry-script:

if (isset($_POST['PHPSESSID']))
{ 
$_COOKIE['PHPSESSID'] = $_POST['PHPSESSID'];
}

The session component will then read the correct session id from the cookie as usual.

i got this from Yii-framework forum

山有枢 2024-10-18 00:36:44

刚刚从事的一个项目遇到了这个问题。我有一个个人资料图像想要更新,但在 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.

狂之美人 2024-10-18 00:36:44

对于那些使用 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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文