Laravel 上传文件缩略图

这里需要注意两个地方:

  • 表单提交方式需要是 post
  • form 添加一个属性为 enctype="multipart/form-data"

在 index.html 加入input 标签

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h1>hello worlds</h1>
<form action="/app/upload" method="post" enctype="multipart/form-data">
@csrf
<p><input type="file" name="upload"></p> <p><input type="submit" value="submit"></p> 

</form> 
</body>
 </html>

public function uploadFile(Request $request){
    $path = $request->file('upload')->store('avatars');
    return $path;
}

 https://www.cnblogs.com/wxy0126/p/10698304.html

Intervention Image

http://image.intervention.io/getting_started/installation

https://www.cnblogs.com/jinxiblog/p/8053008.html

http://image.intervention.io/getting_started/installation

原文地址:https://www.cnblogs.com/as3lib/p/14445245.html