Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7686559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:30:29+00:00 2026-05-31T19:30:29+00:00

I’m trying to get Uploadify 2.1.4 to work with Codeigniter 2.1.0 and CSRF and

  • 0

I’m trying to get Uploadify 2.1.4 to work with Codeigniter 2.1.0 and CSRF and I’m not having much luck. I have a very basic upload controller & the following code for uploadify:

$(function() {
        var cct = $.cookie('csrf_cookie_name');
        $('#uploadifyMe').uploadify({
            'uploader'       : '<?php echo site_url(); ?>js/uploadify/uploadify.swf',
            'script'         : '<?php echo site_url(); ?>upload/',
            'cancelImg'      : '<?php echo site_url(); ?>js/uploadify/cancel.png',
            'multi'          : true,
            'auto'           : false,
            'fileExt'        : '*.jpg;*.jpeg',
            'fileDesc'       : 'Image Files (JPG, JPEG)',
            'fileDataName' : 'imgData',
            'queueID'        : 'fileQueue',
            'simUploadLimit' : 1,
            'sizeLimit'   : 7340032,
            'removeCompleted': false,
            'scriptData' : { 'csrf_token_name' : cct, 'upload' : 'true' },
            'onSelectOnce'  : function(event, data) {
                $('.uploadifyProgress').addClass('progress');
                $('.uploadifyProgressBar').addClass('bar');
            },
            'onComplete' : function(e, i, f, r, d) {
                console.log(r);
            },
            'onError' : function(e, i, f, eO) {
                console.log(eO);
                if(eO.info == 500) {
                    $('#status').prop('class', 'alert alert-error').html('<a class="close" data-dismiss="alert">&times;</a><h4>Hmmm. Something gone wrong it has.</h4> Yoda has discovered that your security token has expired. This is because you have been here for longer than two hours. we cannot refresh your key automatically, please refresh the page and try again.');
                }
            }
        });
});

The problem is when I upload an image I get a HTTP 500 thrown back at me. I now know it’s due to CSRF being turned on since if I turn it off it works fine.

I’ve tried a load of solutions to the problem. The one you can see in my code, and a one from here that clones your session data and sends it across with the CSRF key, but nothing works. I always end up with a 500 HTTP unless I turn off CSRF.

If anyone can help it would be really appreciated. I realize this question seems to get asked a lot, and it’s driving me nutty. On a side note passing the CSRF along with standard AJAX requests works fine, just not with uploadify.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T19:30:31+00:00Added an answer on May 31, 2026 at 7:30 pm

    Use this code, it enables you to define an array of controller methods that are not subject to CSRF: https://github.com/EllisLab/CodeIgniter/pull/236.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.