我创建了包含存储上传文件的目录路径的变量。我想知道这在 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');
}
繁星coding