Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8402043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:57:08+00:00 2026-06-09T21:57:08+00:00

All, I’m trying to get the file size (i.e. not the dimensions, but the

  • 0

All,

I’m trying to get the file size (i.e. not the dimensions, but the actual file size in disk) of a photo using PhoneGap/Cordova 2. So far, the only way I can figure it out is through base64 conversion, then basic arithmetic on the bytes of the b64 string. However, I was wondering if there is a more elegant way to get file size. TIA.

clarification: it must work on iOS 5 and Android 2.3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:57:09+00:00Added an answer on June 9, 2026 at 9:57 pm

    Yeah, if you have the URL to the image from the Camera.getPicture command you pass it to the window.resolveLocalFileSystemURL command who’s success callback is called with a FileEntry object. Then you call the “file” method of FileEntry which calls the success callback with a File object then you can look at the size property of the File object.

    Something like….

    function takePhoto() {
        navigator.camera.getPicture(gotPhoto, onError, { quality: 50,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            sourceType: navigator.camera.PictureSourceType.CAMERA });
    }
    
    function gotPhoto(imageUri) {
        window.resolveLocalFileSystemURI(imageUri, function(fileEntry) {
            fileEntry.file(function(fileObj) {
                console.log("Size = " + fileObj.size);
            });
        });
    }
    

    that should work but I just wrote the code off the top of my head.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

all. We're trying to get some intersect collisions working, but the problem experience is
All, I am just trying to get the zpipe demo working using dev-c++ where
all. I'm using livereload which is autoreload html,js file tool. It is very convenient.But
ALL, I am trying to read the value of 1.5 from the initialization file
All of us probably know .bat for Batch files. But what is the file
All- I am trying to get the user's current location than display that on
all, I am trying to multiply a matrix to a vector in OpenGL, but
All, I have some script tags that are not working in Wordpress. If I
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
All, I am building a small site using PHP. In the site, I receive

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.