c_shelswell Posted June 26, 2008 Share Posted June 26, 2008 Hi I'm just trying to make a simple 6 file upload. Is it possible to do an array_sum on the file size below to determine if the user is uploading too much? eg array_sum($_FILES['size']); Array ( [photo1] => Array ( [name] => bucket.jpg [type] => image/jpeg [tmp_name] => C:\Windows\Temp\php543F.tmp [error] => 0 [size] => 308989 ) [photo2] => Array ( [name] => Haddock.gif [type] => image/gif [tmp_name] => C:\Windows\Temp\php544F.tmp [error] => 0 [size] => 46677 ) [photo3] => Array ( [name] => forest.jpg [type] => image/jpeg [tmp_name] => C:\Windows\Temp\php5450.tmp [error] => 0 [size] => 118882 ) [photo4] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [photo5] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [photo6] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ) cheers Quote Link to comment Share on other sites More sharing options...
ratcateme Posted June 26, 2008 Share Posted June 26, 2008 i dont think array_sum() would work but this should <?php foreach($FILES as $array){ $sum+=$array['size']; } ?> Scott. Quote Link to comment Share on other sites More sharing options...
c_shelswell Posted June 26, 2008 Author Share Posted June 26, 2008 cheers ended up doing something similar. Thanks 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.