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

Laravel 5.3: on last chunks upload getting error #77

Closed kajem closed 5 years ago

kajem commented 5 years ago

I am getting the below error for last chunk when calling below line. $receiver->receive() I have lost last two days with this error. Can anyone please help me to get rid of this error BadMethodCallException in PluggableTrait.php line 90: Call to undefined method League\Flysystem\Filesystem::path

nerg4l commented 5 years ago

Can you share the whole stack trace and which version of laravel-chunk-upload you use?

kajem commented 5 years ago

@nerg4l I am using version 1.2 "pion/laravel-chunk-upload": "^1.2". For the last chunk its try to build full file from the chunks and its getting the above error. I am debugging the code getting this error when calling method getAbsolutePath() in 125 line in vendor\pion\laravel-chunk-upload\src\Save\ParallelSave.php.

image

nerg4l commented 5 years ago

It seems that your ChunkStorage contains a driver which missing the path method. What you can do is fork the project and change the getAbsolutePath method of ChunkFile to return $this->storage->disk()->getPathPrefix().$this->path;. Currently I'm at work but I will try to have a look at it in the evening.

kajem commented 5 years ago

@nerg4l Yes, it was path method not having issue. I have changed he getAbsolutePath() method of ChunkFile to return storage_path(). '/app/'.$this->path. Now it is fixed.

rosariogueli commented 5 years ago

@nerg4l Yes, I was path method not having issue. I have changed he getAbsolutePath() method of ChunkFile to return storage_path(). '/app/'.$this->path. Now it is fixed.

Hi guys, I was struggling with this a couple of days too and Indeed that was the issue. However, I've just updated my package thinking that it would have your fix included, but looks like it hasn't been committed yet?

ps: your fix gives my the following error: Call to undefined method League\Flysystem\Filesystem::getPathPrefix

I've fixed it by replacing the line with the following:

public function getAbsolutePath()
{
    // Original code: 
    // return $this->storage->disk()->path($this->path);

    // Your fix:           
    // return $this->storage->disk()->getPathPrefix().$this->path;

    // What worked for me: 
    return $this->storage->disk()->getDriver()->getAdapter()->getPathPrefix().$this->path;
}