I want to upload files to S3 server. I am able to get image from Camera and read it with file plugin:
this.file.resolveLocalFilesystemUrl(imageData).then((entry: FileEntry) => {
let dirPath = entry.nativeURL;
const dirPathSegments = dirPath.split('/');
dirPathSegments.pop();
dirPath = dirPathSegments.join('/');
this.file.readAsArrayBuffer(dirPath, entry.name).then((buffer) => {
console.log(buffer);
const imgBlob = new Blob([new Uint8Array(buffer)], {type: 'application/image-jpeg;charset=utf-8'});
console.log(imgBlob);
this.videoService.store('match', 118, [imgBlob])
.subscribe(
(event: any) => {
// Handeling server response
},
(responseError) => console.log(responseError));
});
}).catch((err) => console.log(err));
Is there a way to send actual file and not blob or Array buffer? Or can somebody explain why it is better to send Blob or Array buffer.
Thanks