laravel-chunk-upload icon indicating copy to clipboard operation
laravel-chunk-upload copied to clipboard

Last part of chunk not merged with laravel 8

Open jazz7381 opened this issue 3 years ago • 5 comments

the file i upload use dropdown js with chunk is corrupted, the last chunk not merged.

i use laravel 8

jazz7381 avatar Mar 31 '21 11:03 jazz7381

You are free to debug it and fix it? My tests were working. Maybe there will be a bug in special environment while sorting the chunks.

pionl avatar Mar 21 '22 12:03 pionl

Did you find the solution? I have the same problem. I'm using dropzone, $save->isFinished() returns false nginx server

braulioholtz avatar Jul 13 '22 20:07 braulioholtz

I think the problem may be when the request is with loadbalancer, the files generated in the chunk folder are different, the solution was to disable in the config the value of name->use all to false 'chunk' => [ // setup for the chunk naming setup to ensure same name upload at same time 'name' => [ 'use' => [ 'session' => false, // should the chunk name use the session id? The uploader must send cookie!, 'browser' => false, // instead of session we can use the ip and browser? ], ], ],

braulioholtz avatar Jul 15 '22 23:07 braulioholtz

If the session changes then it is definitelly a problem :) Good find. Maybe default value should be session = false ?

pionl avatar Aug 01 '22 10:08 pionl

Same issue. I have many logs with this problem. I use php 8.1.27, DropZone 5.9.3, Laravel 8.40. When the last chunk (for example, 5 out of 5) is uploaded, the file assembly begins, even if not all chunks have been uploaded yet (for example, 4 out of 5).

It is the condition of loading the last chunk that is checked here. https://github.com/pionl/laravel-chunk-upload/blob/cfbc4292ddcace51308a4f2f446d310aa04e6133/src/Save/ChunkSave.php#L166 https://github.com/pionl/laravel-chunk-upload/blob/cfbc4292ddcace51308a4f2f446d310aa04e6133/src/Handler/ChunksInRequestUploadHandler.php#L130

I see the following error in the logs:

SplFileInfo::getType(): Lstat failed for /path/to/chunks/some-file-name.mp4-484aaeb2-4736-4340-a25c-bdf21b739e7f.10.part

Payload of the last request containing an error:

{
  "dzuuid": "62008064-10f1-4eed-b559-4bb02dcb5454",
  "dzchunkindex": "8",
  "dztotalfilesize": "122219582",
  "dzchunksize": "10000000",
  "dztotalchunkcount": "13",
  "dzchunkbyteoffset": "80000000",
  "_token": "********",
  "video": {
    "name": "some-file-name.mp4",
    "size": "0"
  }
}

idk how to solve this problem with code. This is the first time I've encountered chunks. Now I'm looking for the DropZone option to send the last chunk only after unloading all the others. Unsuccessfully

I will be grateful for any help 🙏

UPD: I found such a solution https://github.com/pionl/laravel-chunk-upload/issues/91#issuecomment-607223527. It should work intuitively. I will write about the results – problem is still not solved

vmrfriz avatar Apr 09 '24 23:04 vmrfriz