**************************skip this**************************************************
I can't create symlink() some "symlink() has been disabled for security reasons"
BS!!
I already bought the hosting service for a full year, fee non refundable, no ssh support, i had casually figured "it just needs cpanel and i'll upload my laravel project" yet rn i cant get it to load a single image. ****************************************************************************************
How to save images to public_html
lets say to a file storage/cover_image
if($request->hasFile('cover_image')){
// Get filename with the extension
$filenameWithExt = $request->file('cover_image')->getClientOriginalName();
// Get just filename
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
// Get just ext
$extension = $request->file('cover_image')->getClientOriginalExtension();
// Filename to store
$fileNameToStore= $filename.'_'.time().'.'.$extension;
// Upload Image
Storage::disk('my_upload')->put($fileNameToStore, $request->file('cover_image'));
//$path = $request->file('cover_image')->storeAs('public/cover_images', $fileNameToStore);
} else {
$fileNameToStore = 'noimage.jpg';
}
I made a custom disk in called my_upload
i cant figure out where it saves the file but it doesn't save in public_html/storage/cover_images
//custom my_disk code
'my_upload' => [
'driver' => 'local',
'root' => public_path().'/storage/cover_images',
'visibility' => 'public',
],
if i use storeAs it always stores storage
that is not in public_html
its also not an issue with permissions since am still testing i have set the permissions to 777
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/365EiS3
via IFTTT
Aucun commentaire:
Enregistrer un commentaire