multer

How to access uploaded file from multer?

我怕爱的太早我们不能终老 提交于 2019-11-27 13:22:00
问题 Im able to upload an image to S3 . Now, if the file selected is .gif , I want to be able to convert the .gif file to .mp4 and upload the converted file to S3 . I am able to convert a .gif to .mp4 with ffmpeg only if I give the path of the file. How do I access the uploaded file from Multer ? Below is my code : var express = require('express'); var bodyParser = require('body-parser'); var app = express(); var aws = require('aws-sdk'); var multer = require('multer'); var multerS3 = require(

Cannot app.use(multer). “requires middleware function” error

烂漫一生 提交于 2019-11-27 04:28:26
I'm just starting learning NodeJS and I am stuck with a problem. I would like to upload files to my server. To do so I searched and found out this module multer . Doing as the example on GitHub works: var express = require('express'); var multer = require('multer'); var upload = multer({ dest: 'uploads/' }); var app = express() app.post('/uploadImage', upload.single('image'), function(req, res) { console.log(req.file); }); On posting an image with FormData to /uploadImage the image is saved in the uploads/ directory. The thing is the image is saved with a strange name and I would like to save

Uploading image to amazon s3 using multer-s3 nodejs

徘徊边缘 提交于 2019-11-27 00:38:53
问题 I am trying to upload an image to amazon s3 using multer-s3 , but I am getting this error: TypeError: Expected opts.s3 to be object node_modules/multer-s3/index.js:69:20 This is my server code: var upload = multer({ storage: s3({ dirname: '/', bucket: 'bucket', secretAccessKey: 'key', accessKeyId: 'key', region: 'us-west-2', filename: function (req, file, cb) { cb(null, file.originalname); } }) }); app.post('/upload', upload.array('file'), function (req, res, next) { res.send("Uploaded!"); })

multer callbacks not working ?

萝らか妹 提交于 2019-11-26 21:22:13
问题 Anyone knows why the "rename" function (and all other multer callbacks) are not working? var express = require('express'); var multer = require('multer'); var app = express(); app.use(multer({ dest: 'uploads/', rename: function (fieldname, filename) { return new Date().getTime(); }, onFileUploadStart: function (file) { console.log(file.name + ' is starting ...'); }, onFileUploadComplete: function (file, req, res) { console.log(file.name + ' uploading is ended ...'); console.log("File name : "

nodejs + multer + angularjs for uploading without redirecting

删除回忆录丶 提交于 2019-11-26 17:05:11
问题 I am using Nodejs + Multer +angularjs for uploading files on the server. i have a simple HTML file: <form action="/multer" method="post" enctype="multipart/form-data"> <input type="file" id="photo" name="photo"/> <button id="Button1">Upload</button> </form> Nodejs part: var multer = require('multer'); var storage = multer.diskStorage({ destination: function (req, file, cb) { cb(null, './uploads/') }, filename: function (req, file, cb) { cb(null, file.originalname) } }) app.post('/multer',