ballhogjoni Posted October 28, 2008 Share Posted October 28, 2008 I have this if() that checks the size of two images, but can't figure our why it errors out. I only uploaded one image, so shouldn't the code still execute? I have the || in the if() to say if one or the other is true, execute code. <?php if ($_FILES["image"]["size"] > 0 || $_FILES["auto_send_voucher_image"]["size"] > 0) { //execute code }else{ echo 'error'; } ?> When I print the $_FILES array I get this Array ( [image] => Array ( [name] => [type] => [tmp_name] => [error] => 4 => 0 ) [auto_send_voucher_image] => Array ( [name] => middle_section_header.jpg [type] => image/jpeg [tmp_name] => \xampp\tmp\php117.tmp [error] => 0 => 11533 ) ) This is correct! Link to comment https://forums.phpfreaks.com/topic/130438-dont-know-why-this-doesnt-work/ Share on other sites More sharing options...
bobbinsbro Posted October 28, 2008 Share Posted October 28, 2008 i tend to experience errors in multi-condition if statements if i forget to enclose each statement in (). not sure why... anyway, try: if (($_FILES["image"]["size"] > 0) || ($_FILES["auto_send_voucher_image"]["size"] > 0)) { Link to comment https://forums.phpfreaks.com/topic/130438-dont-know-why-this-doesnt-work/#findComment-676867 Share on other sites More sharing options...
kenrbnsn Posted October 28, 2008 Share Posted October 28, 2008 Please post the form your using. Ken Link to comment https://forums.phpfreaks.com/topic/130438-dont-know-why-this-doesnt-work/#findComment-676884 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.