File upload size check

Hey,

With the following code


	if($_FILES['photoname']['size'] >= 2097152) {
  	$error_msg = 'Combined file size is to large';
	}

Whether I upload one file or 3 files that add up to less than 2mb total, the error message comes back that the file size is to large…

Is the above code wrong?

Thanks

echo the file size $_FILES[‘photoname’][‘size’] it may be that the size of the file as the server sees it is a little larger then you expect. In Windows when you look up the file size there is “file size” and “size on disc”. “size on disc” is generally the larger so it’s best to go by that