multer

Change filename when using express/multer

非 Y 不嫁゛ 提交于 2021-01-20 20:21:41
问题 I'm having trouble uploading a pdf, when I upload it (I'm using ng-file-upload ) the file json that reachs express.js is: { fieldname: 'file', originalname: 'db.pdf', encoding: '7bit', mimetype: 'application/pdf', destination: './client/public/docs/transactions/', filename: '8a3fe7cb7369d9cffa8e17b162ec3d6b', path: 'client\\public\\docs\\transactions\\8a3fe7cb7369d9cffa8e17b162ec3d6b', size: 9179145 } I'd like to change the name to a property that I send from angular to express, here's all

Uploading multiple images with multer to AWS S3

那年仲夏 提交于 2021-01-09 09:45:12
问题 I currently have a backend where i can upload multiple images using multer. these images are passed through sharp to resize the images to create a full and thumbnail image. An entry of the post is stored in my posts table in my database and the fileName of the images is also stored in Post_Images table in my database. My problem is that i am currently using multer diskStorage to store my images on my disk and now i want to store the images on AWS S3. I was trying to implement this but it did

Uploading multiple images with multer to AWS S3

喜你入骨 提交于 2021-01-09 09:43:35
问题 I currently have a backend where i can upload multiple images using multer. these images are passed through sharp to resize the images to create a full and thumbnail image. An entry of the post is stored in my posts table in my database and the fileName of the images is also stored in Post_Images table in my database. My problem is that i am currently using multer diskStorage to store my images on my disk and now i want to store the images on AWS S3. I was trying to implement this but it did

Uploading multiple images with multer to AWS S3

别说谁变了你拦得住时间么 提交于 2021-01-09 09:42:14
问题 I currently have a backend where i can upload multiple images using multer. these images are passed through sharp to resize the images to create a full and thumbnail image. An entry of the post is stored in my posts table in my database and the fileName of the images is also stored in Post_Images table in my database. My problem is that i am currently using multer diskStorage to store my images on my disk and now i want to store the images on AWS S3. I was trying to implement this but it did

Sending file from one node js server to another

≯℡__Kan透↙ 提交于 2021-01-05 12:01:47
问题 So on first server I have route like this: const express = require('express'); const router = express.Router(); const FormData = require('form-data'); const fetch = require('node-fetch'); const multer = require('multer'); const storage = multer.memoryStorage(); const upload = multer({ storage }); router.post('/', upload.single('file'), async (req, res) => { const form = new FormData(); form.append('folderId', req.body.folderId); form.append('file', req.file.buffer, req.file.filename); const

How to rename my originalname when using multer memoryStorage?

 ̄綄美尐妖づ 提交于 2021-01-05 07:28:47
问题 i am trying to rename my file originalname when using multer memoryStorage. I am using multer to upload an array of files and when i console.log(req.files) i get: { fieldname: 'images', originalname: 'snake.jpg', encoding: '7bit', mimetype: 'image/jpeg', buffer: <Buffer ff d8 38134 more bytes>, size: 38184 } The reason i want to rename my originalname is i am storing the images in AWS S3 and if the images have the same name it gets updated not added as a new image. I have tried doing so by

How to rename my originalname when using multer memoryStorage?

心已入冬 提交于 2021-01-05 07:28:20
问题 i am trying to rename my file originalname when using multer memoryStorage. I am using multer to upload an array of files and when i console.log(req.files) i get: { fieldname: 'images', originalname: 'snake.jpg', encoding: '7bit', mimetype: 'image/jpeg', buffer: <Buffer ff d8 38134 more bytes>, size: 38184 } The reason i want to rename my originalname is i am storing the images in AWS S3 and if the images have the same name it gets updated not added as a new image. I have tried doing so by

How to rename my originalname when using multer memoryStorage?

半城伤御伤魂 提交于 2021-01-05 07:26:25
问题 i am trying to rename my file originalname when using multer memoryStorage. I am using multer to upload an array of files and when i console.log(req.files) i get: { fieldname: 'images', originalname: 'snake.jpg', encoding: '7bit', mimetype: 'image/jpeg', buffer: <Buffer ff d8 38134 more bytes>, size: 38184 } The reason i want to rename my originalname is i am storing the images in AWS S3 and if the images have the same name it gets updated not added as a new image. I have tried doing so by

Getting SignatureDoesNotMatch: null error while uploading images to DigitalOcean Spaces using multers3 node.js

给你一囗甜甜゛ 提交于 2021-01-05 07:24:06
问题 Error: code:'SignatureDoesNotMatch' extendedRequestId:undefined message:null name:'SignatureDoesNotMatch' region:null // Load dependencies const aws = require('aws-sdk'); const express = require('express'); const multer = require('multer'); const multerS3 = require('multer-s3'); const app = express(); // Set S3 endpoint to DigitalOcean Spaces const spacesEndpoint = new aws.Endpoint('fra1.digitaloceanspaces.com'); const s3 = new aws.S3({ endpoint: spacesEndpoint, accessKeyId: '*************',

nodejs multer diskstorage to delete file after saving to disk

穿精又带淫゛_ 提交于 2020-12-30 07:38:50
问题 I am using multer diskstorage to save a file to disk. I first save it to the disk and do some operations with the file and then i upload it to remote bucket using another function and lib. Once the upload is finished, i would like to delete it from the disk. var storage = multer.diskStorage({ destination: function (req, file, cb) { cb(null, '/tmp/my-uploads') }, filename: function (req, file, cb) { cb(null, file.fieldname + '-' + Date.now()) } }) var upload = multer({ storage: storage })