9

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.

2
  • 1
    302 is a redirect status code, so there is probably a redirection taking place somewhere along the line. It's impossible to tell where without seeing some code. Maybe there is a redirect somewhere in the .htaccess files?
    – Pekka
    Jan 7, 2011 at 10:51
  • php_flag magic_quotes_gpc 0 php_flag magic_quotes_runtime 0 - in .htaccess Jan 7, 2011 at 10:56

7 Answers 7

21

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.

3
  • 1
    What session information needs to be managed if you pass it through scriptData?
    – Josh
    Oct 24, 2011 at 20:42
  • 1
    It depends on your needs, but it might be sufficient to pass through the session ID and have your target load the session that way. I appreciate it is not best practice to have the session appear on the page as a flash parameter, but in this instance it is definitely the easiest way to integrate Uploadify into an application that requires authentication.
    – plasmid87
    Dec 1, 2011 at 11:39
  • Here's a quick writeup about getting Uploadify to play nicely with Kohana sessions: serializethis.com/… Feb 5, 2013 at 7:11
3

Problem was solved by adding "SecFilterEngine Off" in htaccess

1
  • 1
    This is for Apache 1.x, not 2.x FYI
    – 472084
    Jul 16, 2013 at 15:39
3

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);
                 }
    });
});
1
  • I was doing the same but it is not OK. I managed to make it work without giving forced access to uploading method... Oct 4, 2012 at 11:23
1

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.

2
  • I'm quite sure Pekka is right. try to capture real web traffic with live http headers on Firefox (most other tools won't see file upload traffic) and check the response headers.
    – regilero
    Jan 7, 2011 at 12:47
  • Just a note on live http headers....a great tool, but won't capture the output from uploadify since the post is hidden inside of swf uploader and isn't exposed through firefox. Aug 11, 2011 at 15:02
0

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

0

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.

0

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.