Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
acceder a las propiedades desde el objeto javascript

Tengo debajo del objeto.

 export const multerOptions = { storage: diskStorage({ destination: multerConfig.dest, filename: (_req: any, file: any, cb: any) => { /* istanbul ignore next */ cb(null, `${uuid()}${extname(file.originalname)}`); }, }), };

cuando estoy imprimiendo multerOptions.storage, regresa a continuación.

 diskStorage({ destination: multerConfig.dest, filename: (_req: any, file: any, cb: any) => { /* istanbul ignore next */ cb(null, `${uuid()}${extname(file.originalname)}`); }, }), .

¿Hay alguna forma en que pueda acceder a este nombre de filename o destination ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Este es para cargar un solo archivo

 /** * Module for geting image from s3 cloud server */ exports.upload = multer({ storage: multerS3({ s3: s3, bucket: function (req, file, cb) { const path = process.env.AWS_BUCKET_NAME; cb(null, path || 'uploads/'); }, acl: 'authenticated-read', // acl: 'public-read', key: function (req, file, cb) { console.log("file========", req); // console.log(req.path.split('/')[1]); // console.log(path.parse(file.originalname).name.replace(" ", "-")); // console.log(Date.now() + path.parse(file.originalname).ext); // req.path.split('/')[1] ===== Sub-Folder // path.parse(file.originalname).name.replace(" ", "-") + Date.now() + path.parse(file.originalname).ext ===== File name cb(null, req.path.split('/')[1]+'/'+path.parse(file.originalname).name.replace(" ", "-") + Date.now() + path.parse(file.originalname).ext); } }) }).single('file');

Para carga de archivos múltiples

 /** * Module for geting image from s3 cloud server */ exports.uploadmultiple = multer({ storage: multerS3({ s3: s3, bucket: function (req, file, cb) { const path = process.env.AWS_BUCKET_NAME; cb(null, path || 'uploads/'); }, acl: 'authenticated-read', // acl: 'public-read', key: function (req, file, cb) { console.log(req.path.split('/')[1]); console.log(path.parse(file.originalname).name.replace(" ", "-")); console.log(Date.now() + path.parse(file.originalname).ext); // req.path.split('/')[1] ===== Sub-Folder // path.parse(file.originalname).name.replace(" ", "-") + Date.now() + path.parse(file.originalname).ext ===== File name cb(null, req.path.split('/')[1]+'/'+path.parse(file.originalname).name.replace(" ", "-") + Date.now() + path.parse(file.originalname).ext); } }) }).array('files', 2);

Puedes obtener más información AQUÍ

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!