I am working on a project in which i want to get the link of the file which i uploaded in the storage-app-public directory of laravel. I followed this link StackOverflow question , but when I try to run following command in Vagrant:
php artisan storage:link
It gives following error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
There are no commands defined in the "storage" namespace.
you need to follow this code, I think It will be helpful for you.
$imageTempName = $userdata->file('image_media')->getPathname();
$imageName = $userdata->file('image_media')->getClientOriginalName();
upload the file to the database within the directory using Laravel.
<?php
public static function upload_file(Request $userdata){
$imageTempName = $userdata->file('image_media')->getPathname();
$imageName = $userdata->file('image_media')->getClientOriginalName();
$path = base_path() . '/public/uploads/images/';
$userdata->file('image_media')->move($path , $imageName);
$data=array('media'=>$imageName);
$insert=with(new UserModel)->uploadFile($data);
}
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.