猿问

laravel - 从 linux 文件夹上传目录路径

我创建了包含存储上传文件的目录路径的变量。我想知道这在 Windows 上运行得很好,但在 linux ubuntu 上却不行。也许我提到目录的方式是错误的。


在 Laravel 上跟随控制器;


 public function Store(Request $request){

    $data = array();

    $data['product_name'] = $request->product_name;

    $data['product_code'] = $request->product_code;

    $data['details'] = $request->details;

    $image = $request->file('logo');


    if($image){

        $image_name = date('dmy_H_s_i');

        $ext=strtolower($image->getClientOriginalExtension());

        $image_full_name=$image_name.'.'.$ext;

        $upload_path='home/laravel/udemy/kash';

        $image_url=$upload_path.$image_full_name;

        $success = $image->move($upload_path,$image_full_name);

        $data['logo']=$image_url;

        $product=DB::table('products')->insert($data);

        return redirect()->route('product.index')

                            ->with('success','Product Created Successfully');

    }


梦里花落0921
浏览 144回答 1
1回答

繁星coding

找到了解决方案。$upload_path='$home/laravel/udemy/kash/';
随时随地看视频慕课网APP
我要回答