You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Post('upload/multiple/:type/:cat/:id')
@UseInterceptors(FilesInterceptor('photos',3,{storage: diskStorage({destination: (req,file,cb)=>{constpath=process.env.UPLOAD_FOLDER+`/${req.params.type}/${req.params.cat}/${req.params.id}/`;constexists=fs.existsSync(path);if(!exists){fs.mkdirSync(path,{recursive: true});}cb(null,path);},filename: function(req,file,cb){/* Attention, pas de moyen d'utiliser un service dans un interceptor. Penser à mettre à jour la regex si elle change */cb(null,file.originalname.replace(/\s/gm,'_'));},})}))uploadFiles(
@Param('type')profil: string,
@Param('id')id: string,
@UploadedFiles()files: Express.Multer.File[]){letresponse=newArray();for(letfileoffiles){response.push({name: this.utilsService.normalizeName(file.originalname),url: `${profil}/${id}/${this.utilsService.normalizeName(file.originalname)}`,});}returnresponse;}
@Public()
@Get(':imgpath')getFile(@Param('imgpath')image, @Res()res){returnres.sendFile(process.env.UPLOAD_FOLDER+`/${image}`,{root: '/'});}