I donβt know of any way to get the exact file size sequentially, but if you are ready to jump over several hoops, you can:
1) Estimation based on file size and type. There are several wide variations due to compression methods, but you can probably run some statistics and come up with a semi-order heuristic.
2) In IE, use the fileSize property of the image. In other browsers that support Canvas, use the technique in this question about retrieving image data in JavaScript to capture dataURL, then do the math (multiply by 3/4, since base64 is an increase in size 4/3).
Edit
3) The proposal that others gave (in particular in the question related to Fabien Burned's answer) about receiving HTTP headers is brilliant and accurate. Probably, in some cases this contradicts cross-domain restrictions, but is probably the most consistent and effective method.
Weston c
source share