Sopamo / laravel-filepond

Laravel backend module for filepond uploads
MIT License
202 stars 56 forks source link

Files not being chunked? #61

Closed MrMooky closed 2 years ago

MrMooky commented 2 years ago

It appears that uploads are not being chunked.

That's my input:

<input type="file" class="fileupload" name="attachments[]" multiple data-max-file-size="500MB" data-max-files="10">

This is my JS setup (partly):

const inputElement = document.querySelector('input[type="file"]');
const pond = FilePond.create(inputElement, {
    labelIdle: '{!! __("secrets.attachment_choose_file") !!}',
    labelFileLoading: '{!! __("secrets.attachment_loading") !!}',
    ...
    server: {
        url: '/attachments/api',
        process: '/process',
        revert: '/process',
        patch: "?patch=",
        chunkUploads: true,
        chunkSize: 30000000,
        headers: {
            'X-CSRF-TOKEN': '{{ csrf_token() }}'
        }
    }
});

I also created a folder for the chunks (and it's writeable). But when uploading a ~480MB file, the folder is not touched and no chunks seem to be created. As per setup, 30MB chunks should be created.

Also, I don't understand this one here:

$input = $request->file(config('filepond.input_name'));

if ($input === null) {
    return $this->handleChunkInitialization();
}

Isn't it always not null? So I have my file field, as seen at the top, with the name attachments[] and it seems that the method $this->handleChunkInitialization() is never called here.

Sopamo commented 2 years ago

Usually, when chunking is active, filepond sends one request without any data to get the server id (which you can later use to get the final file). I can't see anything obviously wrong with the code you posted, you could try to do some debugging yourself, try an older filepond js version (maybe the changed something regarding that workflow, but I doubt it) or provide a reproduction in a separate repo, then I could have a look myself.