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 6595477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:56:42+00:00 2026-05-25T17:56:42+00:00

I am using the file uploader plugin (from: https://github.com/valums/file-uploader ) to upload files to

  • 0

I am using the file uploader plugin (from: https://github.com/valums/file-uploader) to upload files to my website.

If you are using a moden web browser (like Firefox 6 or Chrome 13), then it uploads by streaming the file in the POST body, and can give you a progress bar. If you’re using IE (or an old browser), it falls back on the standard $_FILES (using a hidden iFrame).

Everything was working fine, but suddenly I can’t upload 5MB files in Chrome or Firefox. When I upload a 5MB file in Chome or Firefox I get a 500 error and my PHP code is never even ran. If I use Internet Explorer (which uses $_FILES), it works fine.

This has to be a configuration problem, as my PHP code never even runs. So, I checked my settings.

/etc/php.ini

upload_max_filesize = 15M
post_max_size = 16M

I looked for LimitRequestBody, but that’s nowhere to be found (and the default is unlimited).

Settings look right. I debugged this for a while, and I can not figure out what is wrong.

Is there a setting I’m missing? The server has suhosin installed, if that matters.

Here is the backend (I’m using CodeIgniter) code I’m using.

// Can we use the fancy file uploader?
if($this->input->get('qqfile') !== FALSE){ // Yes we can :-)
    $name = preg_replace('/[^\-\(\)\d\w\.]/','_', $this->input->get('qqfile'));
    // Upload the file using black magic :-)
    $input = fopen("php://input", 'r');
    $temp = tmpfile();
    $fileSize = stream_copy_to_stream($input, $temp);
    fclose($input);
    if($fileSize > 15728640){
        $ret['error'] = 'File not uploaded: file cannot be larger than 15 MB';
    }               
    elseif(isset($_SERVER['CONTENT_LENGTH']) && $fileSize === (int)$_SERVER['CONTENT_LENGTH']){
        $path = $folder.'/'.$name; // Where to put the file
        // Put the temp uploaded file into the correct spot
        $target = fopen($path, 'w');
        fseek($temp, 0, SEEK_SET);
        stream_copy_to_stream($temp, $target);
        fclose($target);
        fclose($temp);

        $ret['fileSize'] = $fileSize;
        $ret['success'] = true;
    }
    else{
        $ret['error'] = 'File not uploaded: content length error';
    }
}
else{ // IE 6-8 can't use the fancy uploader, so use the standard $_FILES
    $file = $_FILES['qqfile'];
    $file['name'] = preg_replace('/[^\-\(\)\d\w\.]/','_', $file['name']);
    $config['file_name'] = $file['name'];
    // Upload the file using CodeIgniter's upload class (using $_FILES)
    $_FILES['userfile'] = $_FILES['qqfile'];
    unset($_FILES['qqfile']);
    $config['upload_path'] = $folder;
    $config['allowed_types'] = '*';
    $config['max_size'] = 15360; //15 MB
    $this->load->library('upload', $config);
    if($this->upload->do_upload()){ // Upload was successful :-)
        $upload = $this->upload->data();
        $ret['success'] = true;
        $ret['fileSize'] = $upload['fileSize']/1000;
    }
    else{ // Upload was NOT successful
        $ret['error'] = 'File not uploaded: '.$this->upload->display_errors('', '');
        $ret['type'] = $_FILES['userfile']['type'];
    }
    echo json_encode($ret);
}

I know my code works, as files less than 4MB upload fine (on all browsers). I only have a problem with files bigger than 5mb (using Chrome/Firefox). The weird thing is, this works fine on my test server, but not my production server. They probably have different settings (suhosin is on production, but not on test).

  • 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-25T17:56:43+00:00Added an answer on May 25, 2026 at 5:56 pm

    I looked in my apache logs, and found

    PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 5242881 bytes)

    I changed memory_limit to 64M, now it seems to be ok.

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

Sidebar

Related Questions

jQuery File Uploader: https://github.com/blueimp/jQuery-File-Upload I'm using the plugin above. How in jQuery can I
I am using the multi-upload plugin found at: http://www.fyneworks.com/jquery/multiple-file-upload/ This is what I am
I am using the Uploadify Plugin to Upload files. although this might be a
I'm using a Grails plugin for ajax upload, http://grails.org/plugin/ajax-uploader , that is directly based
I'm using the uploadify jquery plugin to upload multiple files. Everything works fine, but
I am using 'Uploadify' JQuery plugin for file upload. I read the documentation and
I'm using Kohana3 framework and Uploadify plugin for ajax file upload. When I try
I am using jquery form plugin for file upload . my question is how
Using the uploadprogress plugin to show the Progress Bar during file upload and try
I'm trying to make a multi file uploader. I'm using Multiple File Upload Magic

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.