crzyman Posted September 19, 2005 Share Posted September 19, 2005 I have this code: $max=15728640.00; $test = $filesize+$dirsize; if ($test > $max) { $errormsg = "Total file size is greater than the total limit (".getfilesize($max).")."; return; } $filesize is the size of a file about to be uploaded. $dirsize is the size of the directory in which the file is to be uploaded into. $test is the file to be uploaded plus the directory size. Now I am trying to set a limit on the size of the folder in which visitors to my site can upload into. I want that size limit to be 15 MiB. I have tried to do $max = 15 * pow(1024,2); , but that doesn't work (still not sure why?). I try to use $max=15728640 (1.53 MiB right?), but that will not work. Now I tried to use $max=1572864; Then I get: Total file size is greater than the total limit (1.5 MiB). So why when I use $max=15728640 does it allow the file to be upload? I have 40 MiB in the upload folder. Can anyone sort this out for me? I am very confused. Quote Link to comment Share on other sites More sharing options...
crzyman Posted September 19, 2005 Author Share Posted September 19, 2005 Posted this in the wrong forum. Sorry. I have this code: $max=15728640.00; $test = $filesize+$dirsize; if ($test > $max) { $errormsg = "Total file size is greater than the total limit (".getfilesize($max).")."; return; } $filesize is the size of a file about to be uploaded. $dirsize is the size of the directory in which the file is to be uploaded into. $test is the file to be uploaded plus the directory size. Now I am trying to set a limit on the size of the folder in which visitors to my site can upload into. I want that size limit to be 15 MiB. I have tried to do $max = 15 * pow(1024,2); , but that doesn't work (still not sure why?). I try to use $max=15728640 (1.53 MiB right?), but that will not work. Now I tried to use $max=1572864; Then I get: Total file size is greater than the total limit (1.5 MiB). So why when I use $max=15728640 does it allow the file to be upload? I have 40 MiB in the upload folder. Can anyone sort this out for me? I am very confused. 296985[/snapback] Quote Link to comment Share on other sites More sharing options...
marker5a Posted September 19, 2005 Share Posted September 19, 2005 Not sure, but give this a shot. $max='15728640.00'; Before, the decimal was not acting as a decimal, but instead as 1572864000 Give that a shot and let us know Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.