Jump to content

Don't know why this doesn't work


ballhogjoni

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.