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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:16:29+00:00 2026-06-16T20:16:29+00:00

jQuery-File-Upload Upload script: $(‘#fileupload’).fileupload({ url: ‘api/combox_upload.php’, type: ‘POST’, dataType: ‘json’, dropZone: $dropZone, singleFileUploads: true,

  • 0

jQuery-File-Upload

Upload script:

$('#fileupload').fileupload({
    url: 'api/combox_upload.php',
    type: 'POST',
    dataType: 'json',
    dropZone: $dropZone,
    singleFileUploads: true,
    done: function (e, data) {
        attachments = attachments.concat(data.result);
        refreshAttachments();
    },
    add: function(e, data) {
        var file = data.files[0];
        data.context =
            $('<li>',{'class':'file-upload-item'})
                .append($('<span>').text(file.name))
                .append(
                    $('<div>',{'class':'progressbar'})
                    .append($('<div>',{'class':'progress'}))
                ).appendTo($fileUploads);
        data.submit(); // start upload immediately
    },
    progress: function(e, data) {
        var progress = data.loaded / data.total;
        data.context.find('.progress').stop().animate({'width':(progress*100)+'%'},100,'linear');
        //data.context.find('.progress').css({'width':(progress*100)+'%'});
    }
});

In my api/combox_upload.php script I echo json_encode($_FILES) and half the time it comes back blank (I’m watching the XHR request responses in Chrome developer toolbar).

Why is that? How do I fix it so it always submits the file?

Edit: It seems to happen more frequently with larger files.

Could it be an issue with PHP not handling multipart data correctly? I noticed the XHR request comes in immediately, as soon as the file upload begins, but PHP obviously hasn’t gotten the whole file yet… so what does it do? Does it block when I try to access the $_FILES object or does it just give me an empty array? Do I have to something special?

  • 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-06-16T20:16:30+00:00Added an answer on June 16, 2026 at 8:16 pm

    Through trial and error I discovered that this problem only occurs with files larger than about 23 MiB. I’m not sure if that’s a universal constant or specific to how my server is configured.

    Nevertheless, I figured out how to get around this limitation. You need to set singleFileUploads to true and multipart to false, e.g.

    $('#fileupload').fileupload({
        url: 'api/upload.php',
        type: 'POST',
        dataType: 'json',
        singleFileUploads: true,
        multipart: false,
        ...
    

    And then in your php script you can read in the data like this:

    $handle = fopen('php://input', 'r');
    
    $file_data = '';
    
    while(($buffer = fgets($handle, 4096)) !== false) {
        $file_data .= $buffer;
    }
    
    fclose($handle);
    

    The $_FILES array will still be empty, so you can’t get the filename out of there, but it seems to be set in the Content-Disposition header. I wrote a regex to pull it out:

    $headers = getallheaders();
    $filesize = strlen($file_data);
    if(isset($headers['Content-Disposition']) && preg_match('`\bfilename="((?:\\.|[^"])*)"`',$headers['Content-Disposition'], $m)) {
        $filename = urldecode($m[1]);
    } else {
        $filename = 'unknown';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using this plugin: jQuery File Upload My HTML: <input id=fileupload type=file name=files[] data-url=upload.php
I'm using jQuery File Upload with Ruby on Rails 3 $(.jquery-upload).fileupload({ url: /photos, type:
I'm using the Jquery File Script to replace my existing upload script. In my
I'm using the script from jquery file upload and modifying the create_scaled_image function to
hii i am using ajax file upload in this code <script type=text/javascript src=fileuploader.js></script> <script
I'm using uploadify (a jQuery uploading) script, which has basically a PHP file at
I have upload script here: http://www.saaraan.com/2012/05/ajax-image-upload-with-progressbar-with-jquery-and-php the author does not help me what I
I'm using blueimp JQuery file upload script to fancy the uploading of files. You
Am using the ajax file upload plugin from PHP Letter and am using jQuery
I have little problem to get file name after upload (PHP script for upload

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.