我想上传图像使用angularjs或html5,Express.jsjs和mongodb.i有跟随教程我无法上传图像上传文件夹请一些人帮助我如何做that.below我已经给我的架构代码如何使用nodejs将图像上传到文件夹并将路径保存到mongodb中?
my schema
var UserSchema = new Schema({
UserName: {
type: String,
default: '',
trim: true,
},
Avatar: {
type: String,
default: '',
trim: true
},
Email: {
type: String,
default: '',
trim: true
},
Password: {
type: String,
default: '',
trim: true
}
});
我希望将图像与用户信息上传
<form action="/upload" method="post" enctype="multipart/form-data">
Select file to upload:
<input type="file" name="Avatar" id="fileToUpload">
<input type="text" name="UserName" id="name">
<input type="email" name="Email" id="email">
<input type="password" name="Password" id="password">
<input type="submit" value="Upload File" name="submit">
</form>
一两件事我想图像存储到如上传和路径的一些文件夹应该是店database.help我出去.thanks为您的回复
你可以尝试https://github.com/balderdashy/skipper - 任职对我来说就像魅力。 – dark4p
请您分享您的路线和控制器 –
uploadiing后我gettiing响应像这样{“message”:“0文件上传成功!”,“文件”:[]} –