Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plupload last chunk was sent twice during upload #1517

Open
surajem opened this issue Oct 4, 2017 · 0 comments
Open

Plupload last chunk was sent twice during upload #1517

surajem opened this issue Oct 4, 2017 · 0 comments

Comments

@surajem
Copy link

surajem commented Oct 4, 2017

I am trying to upload a file, whose size is above 3gb this is the configuration which i have set.

var uploader =new plupload.Uploader({
    runtimes: 'html5',
    browse_button: 'pickfiles',
    url: self.URLToUpload,
    max_file_count: 1,
    chunk_size: '25mb', //5mb is faster than mb, 25mb is faster still
    multi_selection: false,
    max_retries: 1,
    filters: {
        max_file_size: '8000mb', //8 gig
        mime_types: [{
            title: "Zip files",
            extensions: "zip,zipx"
        }]
    },
    init: {
        BeforeUpload: function (up, file) {



        },

        ChunkUploaded: function (up, file, info) {

        },

        FileUploaded: function (up, file, info) {

        },
        UploadComplete: function(up, files) {



        },

        FilesAdded: function (up, files) {

        },
        Error: function (up, err) {
            //parsing json over here so handling with try catch o avoid break;
            var msg = '';
            try { 
                msg = JSON.parse(err.response).message; 

            } catch (e) {

            }
            /*-600 file size error*/
            if (err.code == -600) {
                new ConfirmationPopup({
                    message: self.MessageToDisplayOnLargeFile,
                    isAlert: true,
                    alertText: self.fileExtensionButtonLabel,
                    width: '400px',
                    title: self.fileExtensionErrorHeader
                });
            } else if (err.code == -601) {
                /*File extension error*/
                new ConfirmationPopup({
                    message: self.FileExtensionErrorMessage,
                    isAlert: true,
                    alertText: self.fileExtensionButtonLabel,
                    width: '300px',
                    title: self.fileExtensionErrorHeader
                });
            }
            else //if (err.code == -200 || err.code == -701 || err.code == -300 || err.code == - 400) {
            { 
                //Getting the failed message to log in db
                var messageToLog = GetFailedMessageToLog(self.HasTheErrorOccurredForTheFirstTime);
                if (msg == 'There is not enough space on the disk.') {
                    messageToLog = msg
                }
                LogErrorMessagesInDb(messageToLog, self.cases, false, self.orginalFileNameUploadedByUser, self.fileNameToUpload);


 self.HandleUploadError(up, err.code);  //Send the  request again to uplaod the file to another server
            }
            //pluploaddev.js
            //HTTP transport error. For example if the server produces a HTTP status other than 200.

            //code: -200
            //message: HTTP Error.
            //Generic I/O error. For exampe if it wasn't possible to open the file stream on local machine.

            //code: -300
            //message: Generic I/O error. For example if it wasn't possible to open the file stream on local machine.

            //code: -400
            //message: Security error

            // * While working on files runtime may run out of memory and will throw this error.
            // MEMORY_ERROR : -701,
        }
    }
});

NewDicomUploader.prototype.HandleUploadError = function(uploader, errorMessage) {

    //Starting the file upload again
    self.HasTheErrorOccurredForTheFirstTime = true;

    uploader.files[0].loaded = 0
    uploader.files[0].status = plupload.QUEUED;

    uploader.start();  
};

if any error occurs while uploading the file i start the upload again but in this case no error had occurred while uploading the file
but still last request of chunk was sent twice

Total chunks created by the plugin were 126 .

125 th chunk was sent twice by the browser

In my plupload configuration i have set max_retries property to one so if any error occurs send that chunk request again but no error had occurred on server side Can any one let me know how do i detect that if any error had occurred on client browser or some thing in the plugin which triggered a another request for the last chunk.
i can add logs in the plupload.full.min.js which might give more clarity what triggered last chunk request, was it due to max_retries or something else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant