Selecionei a img Escrevi descricao cliquei no enviar...
percentual 100%
lista de animais nao tem a minha nova foto
Selecionei a img Escrevi descricao cliquei no enviar...
percentual 100%
lista de animais nao tem a minha nova foto
File info { fieldname: 'imageFile', originalname: 'gatito (2).jpg', encoding: '7bit', mimetype: 'image/jpeg', destination: 'uploads/imgs', filename: 'e1ea8f3f-5bb3-4d34-a025-9b8bb97ccdb0.jpg', path: 'uploads\imgs\e1ea8f3f-5bb3-4d34-a025-9b8bb97ccdb0.jpg', size: 48317 } [Error: SQLITE_CONSTRAINT: NOT NULL constraint failed: photo.photo_description] { errno: 19, code: 'SQLITE_CONSTRAINT' }
upload() {
const allowComments =
this.formularioAnimal.get('allowComments')?.value ?? false;
const description = this.formularioAnimal.get('description')?.value ?? '';
this.animaisService
.upload(description, allowComments, this.file)
.pipe(finalize(() => this.router.navigate(['animais'])))
.subscribe(
(event: HttpEvent<any>) => {
if (event.type === HttpEventType.UploadProgress) {
const total = event.total ?? 1;
this.percentualConcluido = Math.round(100 * (event.loaded / total));
}
},
(error) => console.log(error)
);
}
gravaArquivo(arquivo: any): void {
const [file] = arquivo?.files;
this.file = file;
const reader = new FileReader();
reader.onload = (event: any) => (this.preview = event.target.result);
reader.readAsDataURL(file);
}