I am using angular-file-uploader library to upload 5 images from angular html it is
<angular-file-uploader [config]="afuConfig" (ApiResponse)="upload1($event)">
</angular-file-uploader>//image1
<angular-file-uploader [config]="afuConfig2 " (ApiResponse)="upload2($event) ">
</angular-file-uploader>//image2
this afuConfig executes a nodejs function. How can I know in nodejs which image is being upload image1 or image2?
afuConfig: AngularFileUploaderConfig = {
multiple: false,
formatsAllowed: '.jpg, .jpeg, .png, .gif',
// maxSize: '50' ,
uploadAPI:{
url: 'http://localhost:3999/admin/' + 'upload-avatar'
// headers:{
//'Authorization': this.token,
// }
},
theme: 'attachPin',
hideProgressBar: false,
hideResetBtn: true,
hideSelectBtn: false,
// attachPinText: ' Sube la imagen'
};
I need to refactorize and use only one upload-avatar method in nodejs but I don't know how to get if image is image1 or image2 from the frontend (angular).
In the library documentation says that I must use a parameter in afuConfig
afuConfig: AngularFileUploaderConfig = {
multiple: false,
formatsAllowed: '.jpg, .jpeg, .png, .gif',
// maxSize: '50' ,
uploadAPI:{
url: 'http://localhost:3999/admin/' + 'upload-avatar',
params: {
'image': '1'
}
// headers:{
//'Authorization': this.token,
// }
},
params: {
'image': '1'
}
But I dont know how get the params in nodejs function
var identifier = req.files.file0.params;// this doesnt work
question from:
https://stackoverflow.com/questions/65833751/i-have-to-upload-5-images-how-to-know-each-image-in-nodejs 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…