I'm trying to store an uploaded file using the Storage class, but for some reason only a small part of the file is actually stored (14kb always) and I just can't figure out why...
I created an UploadsManager class which has the following constructor and saveFile function:
<?php
namespace App\Services;
use Illuminate\Support\Facades\Storage;
class UploadsManager
{
protected $disk;
public function __construct()
{
$this->disk = Storage::disk('local');
}
...
public function saveFile($path, $content)
{
return $this->disk->put($path, $content);
}
}
I verified that the $path and $content variables contain sane data just before the call to $this->disk->put by var_dump'ing them and they most definitely do (i.e. the file size, mime type, file name etc. looks exactly like what I expect it should be). To make it even stranger; replacing the line
return $this->disk->put($path, $content);
with
return $content->move(base_path() . '/public/uploads', $path);
(hence bypassing the Storage class altogether) does store the whole file at the right location.
Even more, it did use to work for me with Storage before. This only started happening yesterday. Really at a loss here... Could it be that somehow something got corrupted which causes Storage to fail on me?
Any help or advice on this matter would be greatly appreciated.