multer

How to use Multer without express

╄→гoц情女王★ 提交于 2020-06-28 14:55:12
问题 I am trying to set up image upload for a website with a node.js backend. I am sending the image file as a FormData object on a ajax post request. Can I use Multer without Express to upload the images? If so, how can I do it? (considering that I am not using express I have to manually collect post data) 来源: https://stackoverflow.com/questions/56161896/how-to-use-multer-without-express

How to convert JPG image to WEBP format in Node js ?

二次信任 提交于 2020-06-26 06:53:36
问题 I m trying to upload an image using reactJs and save that image in nodeJs using multer middleware.This is working perfectly but now I want to convert that image to webP format using webp-converter which is a small node.js library for converting other image format to webp format and vice- versa. But I m getting this error : Error: Command failed: E:\Zegal\node_modules\webp-converte ib/libwebp_win64/bin/cwebp.exe -q 80 2a3279b820cc23939eea0295228423ee-- inspironal-quote-about-life-inspiring

Error: The database connection must be open to store files

烂漫一生 提交于 2020-06-17 14:37:45
问题 I am using mongodb atlas to store my data in cloud but i am unable to store it as i am getting the same error continuously Error:The database connection must be open to store files My server side code const mongoURI = 'mongodb+srv://caman3874:qwertyuiopaman1234@@amanco-pexfz.mongodb.net/test?retryWrites=true&w=majority'; const conn = mongoose.createConnection(mongoURI,{useNewUrlParser:true}); let gfs; conn.once('open', () => { gfs = Grid(conn.db, mongoose.mongo); gfs.collection('uploads');

Multer - how to handle files using upload.fields() once files have been submitted

こ雲淡風輕ζ 提交于 2020-06-17 05:19:38
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

Multer - how to handle files using upload.fields() once files have been submitted

时光怂恿深爱的人放手 提交于 2020-06-17 05:19:00
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

Multer - how to handle files using upload.fields() once files have been submitted

浪尽此生 提交于 2020-06-17 05:17:23
问题 I have been experimenting with Multer and was working on saving a movie document to MongoDB using Mongoose. After having the user submit an image in one input field and a video in a separate input field, I use multer's upload.fields() option to handle these files. I want posterImageName to save the filename for 'myImage' and trailerVideoName to save the filename for 'myVideo', so that I can display the image and video when fetched from my database. When I try to set these filenames in my

how to submit “multipart/form-data” from VueJs

亡梦爱人 提交于 2020-06-12 07:29:08
问题 I am using VueJs / axios in frontend and multer in nodejs for a simple file upload to work. So far all tries has been unsuccessful. While this can be achieved in 100 ways in angular 1/2 using ng-upload and other similar plugins. But VueJs seems to be lacking this basic functionality. Based on my research axios doesnt support "multipart/form-data". Ref https://github.com/mzabriskie/axios/issues/789 . multer and other nodejs libraries seems to work with "multipart/form-data" seamlessly from

How to pass multipart request from one server to another in NodeJS?

喜你入骨 提交于 2020-04-16 03:41:25
问题 I have two nodeJS servers, Server 1 gets requests from the client and passes it to server 2 which returns a response to server 1 and it responds to the client. The client uploads a file and it has to be passed the same way as any other rest request that I have. I use axios on server 1 to send the data to server2 and multer on server 2 to store the file on disk. I have an issue sending the request from server1 to server2 because the body of the request contains nothing and the request is

How to pass multipart request from one server to another in NodeJS?

孤街浪徒 提交于 2020-04-16 03:41:06
问题 I have two nodeJS servers, Server 1 gets requests from the client and passes it to server 2 which returns a response to server 1 and it responds to the client. The client uploads a file and it has to be passed the same way as any other rest request that I have. I use axios on server 1 to send the data to server2 and multer on server 2 to store the file on disk. I have an issue sending the request from server1 to server2 because the body of the request contains nothing and the request is

Tracking progress of file upload in multer nodejs

Deadly 提交于 2020-02-24 04:15:27
问题 How to track progress of a file getting uploaded to NodeJs server .I am using multer in server side to upload files. ? Do i need to send some kind of information to the client , So that client gets the upload progress OR this is done internally & client can track progress on its on. Below is the code i am using to upload file : var multer = require('multer'); app.use(multer({dest:'./tmp',limits: {fileSize: 4*1024*1024}}).single('upload')); router.post('/upload',function(req,res){ console.log