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

Problem with resumable.js #25

Closed dels07 closed 6 years ago

dels07 commented 6 years ago

Hi,

I have several problem when tried integrating resumable.js with Minio:

  1. Whenever I tried to use 5 Mb chunk, server will stop at 90-100% with request that returned response with status 413, using 1-4 Mb chunk works fine.
  2. Whenever I use testChunks: true property, it always returned response with status 500.
  3. Currently I use Storage::disk()->put() to upload file to minio, but the leftover file not deleted, any idea on how to delete unused file? Here the code:
    protected function saveFile(UploadedFile $file)
    {
    ...
    // move the file name
    // $file->move($finalPath, $fileName);
    Storage::disk('minio')->put('test/'.$fileName, fopen($file, 'r+'));
    ...
    }
  4. Is it possible to directly use Storage::cloud() or Storage::disk instead of using temp folder?

Other Info: I use default UploadController.php with difference that I use Pion\Laravel\ChunkUpload\Handler\ResumableJSUploadHandler; instead of use Pion\Laravel\ChunkUpload\Handler\AbstractHandler;

My resumable.js config:

var r = new Resumable({
            target: '{{ url("upload") }}',
            chunkSize: 5*1024*1024, // 5 Mb chunk
            simultaneousUploads: 4,
            testChunks: false,
            throttleProgressCallbacks: 1,
            maxFiles: 1,
            fileType: ['mp4'],
            maxFileSize: 5*1024*1024*1024 // 5 Gb file size limit
      });

Thanks

pionl commented 6 years ago

Quick reaction:

  1. The chunk is to large to send for your hosting, check google or take a screenshot of the request in Chrome. Small chunk is fine and some time preferred.
  2. Not implemented, probably not sending any file. Will try to handle this.
  3. Yes, it's mainly used via move method which will delete original file. When successfully uploaded you must delete the file by your self. Otherwise it will be delete by the clean command (when the file is old enough).
  4. Only temp folder can be used, it would be unusable to upload every chunk to cloud and then download it for merging. Very similar to #24
pionl commented 6 years ago

Hi @dels07, have you found any solution?

pionl commented 6 years ago

I have noticed that the last chunk is larger than allowed chunk, this happens always. I've allowed only 1MB but 1.7 MB is sent. Otherwise it works well as it should. See https://github.com/23/resumable.js/issues/51

------WebKitFormBoundaryol9TLaGM73REQldU
Content-Disposition: form-data; name="resumableChunkSize"

1048576
------WebKitFormBoundaryol9TLaGM73REQldU
Content-Disposition: form-data; name="resumableCurrentChunkSize"

1747310

Also simultaneousUploads is not supported.