pionl / laravel-chunk-upload

The basic implementation for chunk upload with multiple providers support like jQuery-file-upload, pupload, DropZone and resumable.js
MIT License
617 stars 167 forks source link

Could not move the file #64

Closed lucastsudaka closed 2 years ago

lucastsudaka commented 5 years ago

Hello, I'm using resumable.js and Laravel 5.8 The service is working well, but not when i try to upload this file:

https://d2v9y0dukr6mq2.cloudfront.net/video/thumbnail/rdM0-USein9859vv/videoblocks-iceland-winter-aerial-view-of-a-large-valley-between-mountains-and-a-river-_bu-7cxyyf_thumbnail-full01.png

Line 214: vendor\symfony\http-foundation\File\UploadedFile.php

throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error)));

Basically, the error happen when the filename is:

videoblocks-iceland-winter-aerial-view-of-a-large-valley-between-mountains-and-a-river-_bu-7cxyyf_thumbnail-full01.png

But if i rename the file to: 1.png The error does not happen.

Tim-NP commented 5 years ago

Probably the file name result of the chunks are too long for your filesystem to handle. Filenames on ext4 can not be longer then 256 bytes. Currently running into the same issue

Tim-NP commented 5 years ago

Fixed this by using a custom upload handler

    class ResumableJSUploadHandler extends BaseResumableJSUploadHandler
    {
        public function getChunkFileName()
        {
            return $this->createChunkFileName(substr($this->fileUuid, 0, 23), $this->getCurrentChunk());
        }
    }

Worked for me

pionl commented 4 years ago

We can then use md5 for better uuid, what do you think?

Thanks @Tim-NP for a solution