dimanche 3 février 2019

How i can upload image to public folder in shared hosting laravel 5

I moved my website from localhost to shared hosting all it's good, but i need when i upload file stored directly to public_html: something like this public_html/storage/ I tried use somenthing like :

symlink('/home/abdoweb/bmcelarave/storage/app/public', '/bmce/public_html/storage')

the problem still exists.

my Controller :

    public function addcategory(Request $request){

    $title = $request->input('category_name');
    $image = $request->file('category-image');
        $name = $image->getClientOriginalName();
        $image->move(storage_path().'/app/public/category',$name);
        $data[] = $name;

    $query=  DB::table('category')->insert(
        [
            'title' => $title,
            'image' => $name,
            "created_at" => Carbon::now()
        ]);
        if($query){
            return redirect('categories');
        }
}

My folder :

home/abdoweb/{bmcelaravel} <= my public folder

Core laravel :

home/{bmce} <= core laravel

Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire