Revision: 6030
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 21, 2008 17:11 by inkdeep
Initial Code
function size_format (filesize) {
if (filesize >= 1073741824) {
filesize = number_format(filesize / 1073741824, 2, '.', '') + ' Gb';
} else {
if (filesize >= 1048576) {
filesize = number_format(filesize / 1048576, 2, '.', '') + ' Mb';
} else {
if (filesize >= 1024) {
filesize = number_format(filesize / 1024, 0) + ' Kb';
} else {
filesize = number_format(filesize, 0) + ' bytes';
};
};
};
return filesize;
};
Initial URL
Initial Description
I use this in addition to the number_format (http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/) snippit in SWFUpload to display the size of files a user is preparing to upload.
Initial Title
Format (humanize) file byte size presentation in javascript
Initial Tags
format, style
Initial Language
JavaScript