Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   CD Forum Support (http://www.chiefdelphi.com/forums/forumdisplay.php?f=8)
-   -   image upload max size (http://www.chiefdelphi.com/forums/showthread.php?t=1171)

Mike Soukup 26-11-2001 01:22

image upload max size
 
In the image upload page, it says the max size is 250kb. Do you really mean 250 kilo-bit, or do you mean kilo-byte? I tried to upload a pic that's 248kB and it didn't go through because it's too big.

Brandon Martus 26-11-2001 04:21

PHP Code:

$FILESIZE=250000;

if ( 
filesize($source) > $FILESIZE ) { 
  
// .. error .. 



'filesize' returns the file size in bytes.

Mike Soukup 26-11-2001 10:48

kilo != 1000
 
Ok, now I know what my problem is. My 248KB file is less than 250KB but greater than 250,000B ;)

A little clarification for those who are confused. In computers, 1 kilo does not equal 1000 (10^3), it's actually 1024 (2^10). mega (2^20), giga (2^30), tera (2^40) and whatever's after that also differ from the metric prefixes. So after a quick calculation, my 248KB file is actually (248KB * (1024B / 1KB)) = 253,925B.

Mike

Nate Smith 26-11-2001 11:29

Of course, that could be corrected to a "true" 250KB by changing the code so it looks something like this...

PHP Code:

$FILESIZE=250;

if ( (
filesize($source) / 1024) > $FILESIZE ) { 
  
// .. error .. 




All times are GMT -5. The time now is 23:04.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi