Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Uploadingimage to server

$
0
0

@andjelicnikola wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>