Analyze image before upload

Hello!

How can I analyse an image before upload?
I mean, I want to determine the size of the file and the image resolution before it is actually sent to the server, using Javascript, or something client-side?