Search code examples
javascriptfile-uploadfine-uploader

Multipart issues with chunking


I am trying to setup a test implementation of FineUploader, but I am running into a problem with chunking. I have debug set to true, and everything seems to be going great until the very end of the process where I get the following errors:

"[Fine Uploader 5.0.2] All chunks have been uploaded for 0 - finalizing...." custom.fineuploader-5.0.2.js:207 "[Fine Uploader 5.0.2] Submitting All Chunks Done request for 0" custom.fineuploader-5.0.2.js:207 "[Fine Uploader 5.0.2] Sending POST request for 0" custom.fineuploader-5.0.2.js:207 "[Fine Uploader 5.0.2] Received response status 200 with body: {"error":"Server error. Not a multipart request. Please set forceMultipart to default value (true).","uploadName":null,"template":"undefined","category":"undefined"}" custom.fineuploader-5.0.2.js:207 "[Fine Uploader 5.0.2] Finalize successful for 0"

The bottom error says "Server error. Not a multipart request. Please set forceMultipart to default value (true).", but as far as I can tell my code it setup that way already. Here is what I have in the code for it:

var uploadHandler = $('#fine-uploader').fineUploader({
            debug: true,
            request: {
                endpoint: 'server/endpoint.php',
                forceMultipart: true,
                params: // send the values to backend file (endpoint.php)
                {
                    template:function() {
                        return $("#price_template_id").val();
                    },
                    category:function(){
                        return $("#category_id").val();
                    }
                }
            },
            validation: { // validation for the images uploaded
                allowedExtensions: ['jpeg', 'jpg'],
                sizeLimit: 20971520 // 20 MB = 20 * 1024 * 1024 bytes 20971520
            },
            editFilename: {
                enabled: true
            },
            display: { //display image on upload
                fileSizeOnSubmit: true
            },
            resume: { //enable resume on upload
                enabled: true
            },
            retry: {  //enable retry on upload
                enableAuto: true
            },
            forceMultipart: {
                enabled: true
            },
            chunking: { //enable chunking on upload
                concurrent: {
                    enabled: true
                },
                enabled: true,
                partSize: 200000, //200KB per chunk
                success: {
                    endpoint: 'server/endpoint.php'
                }
            },
            template: "qq-template",
            autoUpload: true, 
            showMessage: function(message) {  //show message if any error occur during uplaod process
                alert(message); 
            }
        })

You can see/test the implementation here: http://web3.instaproofs.com/temp/fineuploaderv3/

Any ideas on what I am doing wrong with this?

Thanks!


Solution

  • Your server is not properly handling the "all chunks done" POST request. This is not a multipart encoded request. It is sent by Fine Uploader after the last chunk has successfully been uploaded to the server. This POST contains a URL-encoded message-body with information about the completed chunked file. Your server should combine all chunks associated with the file and then respond appropriately. More info at http://docs.fineuploader.com/branch/master/features/concurrent-chunking.html#server-side-implications.