Just a simple doubts-
i'm trying to store my image and video file on storage using Storage facade. but i'm confused because i'm unable to store that file on storage folder. i'm using intervention image package and when i just try to save my modified $file
Storage::put($file);
it's throwing error that 2 argument missing etc.
i searched everywhere on the net regarding this issue and i found
Storage::put($file , $content)
now what is $content in this case when i'm trying just save an image to my folder ? please give me example-
and one more thing
How do i return a full path of that file which can be accessible from different domain. i'm building an API :)
Thanks for the help in advance
What disk your using 'public', 'local' basically where your storing it?
\Storage::disk('local')->put($file_name, $the_file);
The disk settings can be view in the config/filesystems.php
file.
Also the $content
is the actually item/file you want to save. Here is an example of what ive done recently..
// the $image is from $request->file('file');
$thefile = \File::get($image);
$file_name = $title->slug . '-' . $year . '.jpg';
\Storage::disk('local')->put($file_name, $thefile);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With