always returning true no matter what...
Code: Select all
if(imagesx($_FILES["file"]["tmp_name"]) > AVATAR_MAX_WIDTH || imagesy($_FILES["file"]["tmp_name"]) > AVATAR_MAX_HEIGHT)Moderator: General Moderators
Code: Select all
if(imagesx($_FILES["file"]["tmp_name"]) > AVATAR_MAX_WIDTH || imagesy($_FILES["file"]["tmp_name"]) > AVATAR_MAX_HEIGHT)By the time $_FILES is populated, the file has already been uploaded.psychotomus wrote:I don't feel like uploading the image then deleting if [it's too] big.
If the dimensions of the image matter, do some research to find a reasonable maximum file size for an image with the format and number of pixels you expect. To validate an uploaded image, first test the file to confirm that it does not exceed the maximum file size. Then create an image resource from the file and test the dimensions.PHP Manual wrote:int imagesx ( resource $image )
int imagesy ( resource $image )