fine-uploader icon indicating copy to clipboard operation
fine-uploader copied to clipboard

newUuid server response not working (chunking upload)

Open OndrejIT opened this issue 7 years ago • 15 comments

Type of issue [REQUIRED]

bug?

Uploader type [REQUIRED]

traditional

Fine Uploader version [REQUIRED]

5.13.0

Browsers where the bug is reproducible [REQUIRED]

Firefox 51.0

Operating systems where the bug is reproducible [REQUIRED]

Linux

Hello my server send newUuid, but in chunking upload not working. Fineupload don't respect new uuid. When i upload non chunging, fineuploader new uui respected.

Here is my log from broswer...

Chunking upload - not working:

[Fine Uploader 5.13.0] Sending chunked upload request for item 2.0, bytes 1-2000000 of 5917584.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] xhr - server response received for 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] responseText = {"newUuid":"23cf9b49-ff28-44ed-af80-df23cffcf36d","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Received response status 200 with body: {"newUuid":"23cf9b49-ff28-44ed-af80-df23cffcf36d","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunked upload request succeeded for 2, chunk 0  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunk 0 for file 2 uploaded successfully.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Sending chunked upload request for item 2.1, bytes 2000001-4000000 of 5917584.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] xhr - server response received for 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] responseText = {"newUuid":"e04bb3e4-9111-45ee-8efc-abd9768f9bc6","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Received response status 200 with body: {"newUuid":"e04bb3e4-9111-45ee-8efc-abd9768f9bc6","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunked upload request succeeded for 2, chunk 1  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunk 1 for file 2 uploaded successfully.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Sending chunked upload request for item 2.2, bytes 4000001-5917584 of 5917584.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] xhr - server response received for 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] responseText = {"newUuid":"87ab72d9-c744-4689-aa59-770c3a07025b","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Received response status 200 with body: {"newUuid":"87ab72d9-c744-4689-aa59-770c3a07025b","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunked upload request succeeded for 2, chunk 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Chunk 2 for file 2 uploaded successfully.  fine-uploader.js:162:21
[Fine Uploader 5.13.0] All chunks have been uploaded for 2 - finalizing....  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Submitting All Chunks Done request for 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Sending POST request for 2  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Received response status 200 with body:   fine-uploader.js:162:21
[Fine Uploader 5.13.0] Finalize successful for 2

Normal upload - working:

[Fine Uploader 5.13.0] Sending simple upload request for 1  fine-uploader.js:162:21
[Fine Uploader 5.13.0] xhr - server response received for 1  fine-uploader.js:162:21
[Fine Uploader 5.13.0] responseText = {"newUuid":"2784dbb2-b711-4921-b703-854c817f26e0","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Received response status 200 with body: {"newUuid":"2784dbb2-b711-4921-b703-854c817f26e0","success":true,"preventRetry":false}
  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Simple upload request succeeded for 1  fine-uploader.js:162:21
[Fine Uploader 5.13.0] Server requested UUID change from '77d58f5c-72e7-423e-808e-2763e428892d' to '2784dbb2-b711-4921-b703-854c817f26e0'  fine-uploader.js:162:21

OndrejIT avatar Jan 29 '17 15:01 OndrejIT

As the issue template asked, please show your code

rnicholus avatar Jan 29 '17 15:01 rnicholus

And also let me know when this last worked (version)

rnicholus avatar Jan 29 '17 15:01 rnicholus

@rnicholus <!-- Fine Uploader JS file ====================================================================== --> <script src="/static/fine-uploader/fine-uploader.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> ...

<!-- Your code to create an instance of Fine Uploader and bind to the DOM/template
====================================================================== -->
<script>
    var manualUploader = new qq.FineUploader({
        element: document.getElementById('fine-uploader-manual-trigger'),
        template: 'qq-template-manual-trigger',
        request: {
            endpoint: "/upload-server/upload"
        },
        chunking: {
            enabled: true,
            success: {
                endpoint: "/upload-server/chunksdone"
            }
        },
        thumbnails: {
            placeholders: {
                waitingPath: '/static/fine-uploader/placeholders/waiting-generic.png',
                notAvailablePath: '/static/fine-uploader/placeholders/not_available-generic.png'
            }
        },
        maxConnections: 3,
        autoUpload: false,
        debug: true
    })

    qq(document.getElementById("trigger-upload")).attach("click", function() {
        manualUploader.uploadStoredFiles();
    });
</script>

`

OndrejIT avatar Jan 29 '17 15:01 OndrejIT

And also let me know when this last worked (version)

I don't know, I tested 5.13.0, 5.10.0 - Not working...

OndrejIT avatar Jan 29 '17 15:01 OndrejIT

Looks like this may have never been implemented for chunked uploads. The safest option may be to check for newUuid on the response to the request made to the chunking.success.endpoint.

rnicholus avatar Jan 29 '17 15:01 rnicholus

In docs: Providing your own UUID for files

If you would like to track files with your own generated UUID, you can return the new UUID for the file at any time in your server's response. If chunking is enabled, it generally would be most prudent to return this new UUID in the response to the first or last chunk. Once you return the new UUID in your response, Fine Uploader will update its client-side records and begin to use that UUID from that point forward. New UUIDs must be returned as the value of a newUuid property. See the values section above for an example. http://docs.fineuploader.com/endpoint_handlers/traditional.html

OndrejIT avatar Jan 29 '17 15:01 OndrejIT

That may have made sense a while back, but the concurrent chunking feature changes that a bit. Since it was never implemented, or at least it hasn't been possible for quite a long time, it's not clear to me now if that was ever a reasonable assumption. Again, the safest approach at this point seems to involve mandating the newUuid be returned in response to the success endpoint

rnicholus avatar Jan 29 '17 17:01 rnicholus

ok thx.

OndrejIT avatar Jan 29 '17 19:01 OndrejIT

I'll leave this open as it must be addressed. It is indeed a bug.

rnicholus avatar Jan 30 '17 00:01 rnicholus

Since I believe implementing this will be non-trivial, I plan to wait until I hear from other users who depend on or expect the ability to change the UUID of a file via an upload request response.

rnicholus avatar Jan 30 '17 02:01 rnicholus

@rnicholus I too would like the behaviour that is documented. Is there a workaround to change the UUID based on a response callback?

AlexC avatar May 25 '17 14:05 AlexC

Depending on your needs, this may help https://docs.fineuploader.com/branch/master/api/methods.html#setUuid

rnicholus avatar May 25 '17 14:05 rnicholus

Thanks for the quick response, that's just what I was after. Here's what I'm doing for other peoples reference:

onUploadChunkSuccess: (id, chunkData, response) => { uploader.methods.setUuid(id, response.uuid) }

AlexC avatar May 25 '17 15:05 AlexC

I experience the same problem with chunked upload.

My need is to free chunks on the server when the upload is canceled. The problem is that when we submit the file through addFile, we don't get an id or uuid in return to trace the upload. When we add our own id through params to addFile, we don't get it back when we call getUploads.

This leaves us with no means to trace uploads when canceled. We tried to use newUuid but it is not working. Do you have any suggestion ?

Thanks.

sellou avatar Mar 06 '18 17:03 sellou

I have the same problem as @sellou. Would be highly useful if addFile will return id/UUID or both. I use S3 and can't use the newUUID because even if I set the param object I am not able to get these params within FineUploader.getUploads(id) method. After uploading the file I use the returned URL to submit this URL to my backend and register the file to be used(play video) by the logged USER on my Web APP. So if addFile will return the ID or UUID everything will be much easier.

Note: just add that I noted the UUID can change in case we already uploaded some % of a file and the resume feature is used. In that case inside onSubmit callback we have one UUID and inside onUpload callback we have another UUID, So will be nice if addFile will return consistent UUID.

andreiucm avatar Apr 01 '18 14:04 andreiucm