Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

Problem was solved by adding "SecFilterEngine Off" in htaccess

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);
                 }
    });
});

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.

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

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.

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/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top