小编Put*_*ari的帖子

Laravel 5.2中的多个图像上传

最后我可以上传和移动图像,但现在我想在Laravel上创建多个上传图像.那可能吗?我必须使用数组才能制作它吗?

我可以从这段代码中稍微修改一下吗?

它在我的ProductController.php上

$picture = '';

if ($request->hasFile('images')) {
    $file = $request->file('images');
    $filename = $file->getClientOriginalName();
    $extension = $file->getClientOriginalExtension();
    $picture = date('His').$filename;
    $destinationPath = base_path() . '\public\images/';
    $request->file('images')->move($destinationPath, $picture);
}

if (!empty($product['images'])) {
    $product['images'] = $picture;
} else {
    unset($product['images']);
}
Run Code Online (Sandbox Code Playgroud)

谢谢.注意:我上面的代码来自stackoverflow上的一个善良的人,再次感谢;)

php forms image-uploading laravel laravel-5.2

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

forms ×1

image-uploading ×1

laravel ×1

laravel-5.2 ×1

php ×1