1

I'm trying to implement a simple chunked file uploads for large files using the jQuery-File-Upload plugin. I cloned the GitHub-repo into a folder and changed my main.js to the following:

$('#fileupload').fileupload({
    maxChunkSize: 10000000,
    add: function (e, data) {
        var that = this;
        $.getJSON('server/php/', {file: data.files[0].name}, function (file) {
            data.uploadedBytes = file && file.size;
            $.blueimp.fileupload.prototype.options.add.call(that, e, data);
        });
    }
});

as described in the docs. This works fine for files up to 2GB (I can see the chunking in the console and on the server), yet when I try to upload files larger than 2.1GB the following will happen: The last chunk of data will be correctly appended to the existing file myUpload.file and then the script will start writing a new file myUpload.file (1), starting from scratch, no errors will be thrown, both client- and server-side. The same happens when the second file has reached the size of 2.1GB. The file's progress counter will be reset, whereas the overall progress counter will overflow and tell me that I'm 142% (and counting) done.

I'm running PHP 5.3.5 on the server side.

I already tried fiddling with the settings for max_post_size, upload_max_file_size and memory_limit like described in the plugin's FAQ and this question on SO but didn't have any success. I also found this issue on GitHub that sounds similar, but it got closed without any real input.

Other than fiddling with the php.ini settings I am pretty clueless what to do about this.

Community
  • 1
  • 1
m90
  • 11,434
  • 13
  • 62
  • 112

1 Answers1

2

Check if the server OS and filesystem supports that large files. Very Old 32-bit systems had issues with 2GB and above. Also I suspect that 32-bit framework may have internal counter defined as 32-bit signed integer.

This is just plain guess from computer basics but worth trying it

Edit: This is what you are looking for 4GB HTTP File Uploads Using jQuery-File-Upload, Apache and PHP

Community
  • 1
  • 1
CKmum
  • 641
  • 6
  • 17
  • I'm not sure about PHP limitations, but my OSs (both Windows and Linux) support files of that size. Upload / transfer restrictions should be no issue due to the chunking of the files (that seems to work perfectly). – m90 Nov 30 '12 at 16:58
  • 2
    chunk size is not the problem (as per your earlier description) but when the file size grows over 2 GB (2^31), there's an issue. That's how I see it. And logically it points to some 32-bit issue. Why don't you write a sample php page to test file size limits and watch (internal and your code) php variables. Just give it a try! ... Also dump internal php variables first before doing anything else – CKmum Nov 30 '12 at 18:57
  • related: http://stackoverflow.com/questions/13574542/4gb-http-file-uploads-using-jquery-file-upload-apache-and-php?rq=1 – CKmum Nov 30 '12 at 19:09
  • Sounds reasonable, I also just found this: www.php.net/manual/en/features.file-upload.common-pitfalls.php#44626 I' guess I'll write a simple test next just to sort these things out. Thanks a lot for the input. – m90 Nov 30 '12 at 19:17