I would like to measure the fileSize of the image (without uploading it -
php).
I use:
var size_pic = document.getEle mentById('num1' ).childNodes[0].fileSize;
alert("size = " + size_pic);
which works on IE with one exception.
With a first time displayed image, the script displays a size= -1 The image
is displayed on the first pass. The fileSize script is located after the
img script.
var image_display=d ocument.createE lement('img');
image_display.s rc='file://' + field;
image_display.n ame = 'pict';
document.getEle mentById('num1' ).appendChild(i mage_display);
The second pass is correct. size = 11479
Is this a cache problem? The first pass caches the file, the second pass
reads the file?
I tried running - var size_pic
=document.getEl ementById('num1 ').childNodes[0].fileSize; - twice but that
made no difference.
Is there a work around for this problem.
Is there a better way to measure filesize in JavaScript?
Have a good day!
Ken
php).
I use:
var size_pic = document.getEle mentById('num1' ).childNodes[0].fileSize;
alert("size = " + size_pic);
which works on IE with one exception.
With a first time displayed image, the script displays a size= -1 The image
is displayed on the first pass. The fileSize script is located after the
img script.
var image_display=d ocument.createE lement('img');
image_display.s rc='file://' + field;
image_display.n ame = 'pict';
document.getEle mentById('num1' ).appendChild(i mage_display);
The second pass is correct. size = 11479
Is this a cache problem? The first pass caches the file, the second pass
reads the file?
I tried running - var size_pic
=document.getEl ementById('num1 ').childNodes[0].fileSize; - twice but that
made no difference.
Is there a work around for this problem.
Is there a better way to measure filesize in JavaScript?
Have a good day!
Ken
Comment