我正在创建一个社交应用类型的网站,希望用户在该网站上上传图片。我正在尝试上传带有干预图像的图像,但是StoreAs()方法似乎不支持干预图像。
public function uploadSubmit(Request $request)
{
$property = Property::create($request->all());
//$property = Property::create($request->all());
$paths = [];
foreach ($request->photos as $photo) {
$extension = $photo->getClientOriginalName();
$filename = $property->id. 'kejalist' . $extension;
$pic = Image::make($photo)->resize(400, 100);
$paths[] = $pic->storeAs('housepics', $filename);
// $pic->save();
Picture::create([
'property_id' => $property->id,
'name' => $filename
]);
}
//return 'Upload successful!';
Flash::success('Property saved successfully.');
return redirect('/');
}
我想将上传的图像存储在app / Storage文件夹中。 请注意,如果我删除干预措施,则代码运行良好。
编辑在路径中有错字[] = $ pic ***