flowjs / flow.js

A JavaScript library providing multiple simultaneous, stable, fault-tolerant and resumable/restartable file uploads via the HTML5 File API.
Other
2.96k stars 346 forks source link

Failed to upload large file, small files are OK #336

Closed taurenshaman closed 3 years ago

taurenshaman commented 3 years ago

initial code:

this.resumable = new Flow({
            target: ctx.uploadUri,
            generateUniqueIdentifier: function (file, event) {
                return CryptoJS.MD5(file.name).toString(CryptoJS.enc.Hex);
            }
            //query: { upload_token: 'my_token' }
        });
        const r = this.resumable;
        r.on('fileSuccess', function (file, message) {
            //console.log('fileSuccess', file);
            //console.log(message);
            try {
                const resultData = JSON.parse(message);
                if (ctx.onUploaded)
                    ctx.onUploaded(resultData.id, resultData.uri, resultData.imgInfo);
            }
            catch { }
        });

Files smaller than 1MB are all OK. The large testing file: 4.01MB (PNG) Here is the server cache: image

So chunks of #2 and #3 are missing/faild ? So flow.js has no check for the server response?

Thank you very much! ❤❤❤

taurenshaman commented 3 years ago

I change simultaneousUploads to 1, it works well now.

{
            target: ctx.uploadUri,
            singleFile: true,
            forceChunkSize: true,
            simultaneousUploads: 1,
            maxChunkRetries: 3,
            chunkRetryInterval: 500,
            generateUniqueIdentifier: function (file, event) {
                return CryptoJS.MD5(file.name).toString(CryptoJS.enc.Hex);
            }
            //query: { upload_token: 'my_token' }
        }