Size of taken picture from camera

Hi guys,
my app take a picture and then try to upload to S3.

I use the File Transfer plugin, and I need to set ‘Content-Length’ to the array header.

I do:

let options: FileUploadOptions = {
           fileKey: 'file',
           fileName: 'name.jpg',
           mimeType: "image/jpeg",
           httpMethod: "PUT",
           chunkedMode: false,
           headers: {
            "Content-Type": 'image/jpeg',
            'Content-length' : ????
        fileTransfer.upload(this.imagePath, url.url, options)
         .then((data) => {
           // success
           console.log("success: " , data);
         }, (err) => {
           // error
           console.log("error upload:", JSON.stringify(err, null, 4));

this.imagePath is the path of the taken picture from camera, it’s like this:


I have only the path because in configuration of the camera I specified:


How to get the length of the picture?


I also facing the problem with video and images upload to the server

You both can have a look at this…

maybe I didn’t explain good my issue. Your link doesn’t show me how to retrieve the size of taken picture.
My issue is: I take a picture, then I have its path, now I want get the size (length of bytes)

Hi, @gjord

You have to use DOM properties get image actual dimensions.

Try this:

<img id="imageid" src="file:///storage/emulated/0/Android/data/">

var img = document.getElementById('imageid'); 

var width = img.clientWidth; // For width
var height = img.clientHeight; // For height

Thank you.

I thanks to you, but my question is about size (lenght, bytes…), not about CSS property :frowning:

Have you tried the technique described here? Incidentally, the file-transfer plugin is obsolete and should not be used in new code.

and what I have to use?