Reputation: 12618
I have a Laravel 5.6 project which has images stored using the Storage facade.
I am trying to take an image that I have stored and move it to S3 storage like this..
$contents = Storage::disk('local')->url($image->filename);
$storagePath = Storage::disk('s3')->put("uploads", $contents, 'public');
This uploads a file to the S3 bucket called 'uploads' that contains the path to the file like this...
/storage/myimage.jpg
How can I upload the actual file instead of saving the path?
Upvotes: 1
Views: 2818
Reputation: 63
After adding use Illuminate\Support\Facades\Storage;
You can do it like this:
$contents = Storage::get('file.jpg');
Upvotes: 0
Reputation: 4035
You can do it like this:
$contents = Storage::get('file.jpg');
Upvotes: 2