@eramos-dve wrote:
Hey !
I’m having some troubles using FormData() when I run my app on an Android device.
In fact, I want to take a pic with the camera.
So this is my codeaccount.component.ts
:this.camera.getPicture(options).then( // Get the image in base 64 (imageData) => this.accountService.uploadImage(image).subscribe((data) => console.log(data)), (err) => { console.error(err); } );
account.service.ts
:uploadImage(image: string): Observable<any> { const body = new FormData(); body.append('key', environment.key.toString()); body.append('userauth', this.tokens.get()); body.append('image', image); console.log('Params :', body); return this.http.post<any>(`${environment.api}`, body) .pipe( map((res => { console.log('Res :', res); if (res.error) { throw new Error(res.msg as string); } return res; })) ); }
console.log(body) give me an empty FormData object.
I have this issue ONLY when I want to take a pic with the camera.
If I select a pic in the gallery, it’s working.Do you have an idea about it ?
Posts: 1
Participants: 1