vue+express上传头像到数据库中img的路径

项目结构

express中间件指定静态资源目录

app.use("/static",express.static(path.join(__dirname,"/public")))

图片下载到本地路径 app.use(multer({dest:"./public"}).array("file"))  请注意这里的“file” ,他需要和你的 <input type="file"  name="file" > 一致

上传到数据库的路径

原文地址:https://www.cnblogs.com/shanchui/p/12922680.html