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 Link to comment https://forums.phpfreaks.com/topic/112004-solved-array_sum-on-multiple-file-upload/ 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. Link to comment https://forums.phpfreaks.com/topic/112004-solved-array_sum-on-multiple-file-upload/#findComment-574941 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 Link to comment https://forums.phpfreaks.com/topic/112004-solved-array_sum-on-multiple-file-upload/#findComment-574962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.