1

In PHP, there is a function named

GetRealVolume(filesize("FILEPATH"));

I seacrh one for javascript. Can i get the Filesize from a Filepath?

I want make a link like that:

<a href="FILEPATH">Klick for Download [FILESIZE]</a>
1
  • Are Files from same domain or different domain? Commented Feb 12, 2014 at 11:39

1 Answer 1

1

HTML5 allows you to do stuff like this through the File interface: http://www.html5rocks.com/en/tutorials/file/filesystem/#toc-file

so you can do:

fileEntry.getMetadata(function(metadata){console.log(metadata.size)})

The downside is that this would only work on your application sandbox, it is not that easy to access the general file system for security reasons, although you could give this atry: http://bytes.com/topic/javascript/answers/460516-check-file-size-javascript.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried this: $.get("1234/docs/new/file.pdf", function(data){ console.log(data.size); }); but it doesn't work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.