HTTP Error 302 using uploadify

2019-04-22 18:58发布

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.

7条回答
叛逆
2楼-- · 2019-04-22 19:35

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

查看更多
我想做一个坏孩纸
3楼-- · 2019-04-22 19:40

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);
                 }
    });
});
查看更多
够拽才男人
4楼-- · 2019-04-22 19:42

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.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-04-22 19:43

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.

查看更多
我想做一个坏孩纸
6楼-- · 2019-04-22 19:51

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/

查看更多
做自己的国王
7楼-- · 2019-04-22 20:00

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.

查看更多
登录 后发表回答