Check a file's filesize before uploading it to the server.

From #6496.

Only do this if the browser supports checking a file's size. Older browsers do not allow this.