Page 1 of 1

Error on if script

Posted: Wed Jan 28, 2004 8:19 am
by pinehead18

Code: Select all

<?php
if ($_POST['submit']) {
$image_size = getimagesize($_FILES['file']['tmp_name']);
if (isset($_FILES['file']['name'])) {
    if ((($_FILES['file']['type'] == 'image/gif') || ($_FILES['file']['type'] == 'image/pjpeg')) && (($_FILES['file']['size']
< 512000)) && (($image_size[0] <= 370)) && (($image_size[1] <= 480))) {
?>
I seem to be receiving a parse error with this.. I didn't finish off the if statement with the } however, the parse error started when i added tyhe two && image_size arrays.

Thank you for your help.

Anthony

Posted: Wed Jan 28, 2004 8:24 am
by jaxn
You had a couple of extra parentheses.

Try this:

Code: Select all

<?php
if ($_POST['submit']) {
    $image_size = getimagesize($_FILES['file']['tmp_name']);
    if (isset($_FILES['file']['name'])) {
        if ((($_FILES['file']['type'] == 'image/gif') || ($_FILES['file']['type'] == 'image/pjpeg')) &&    (($_FILES['file']['size']
< 512000)) && (($image_size[0] <= 370) && ($image_size[1] <= 480))) {
            // do something
        }
    }
}
?>
-Jackson

Posted: Wed Jan 28, 2004 8:27 am
by pinehead18
We seemed to have fixed the parse error.. However i have not tested to see if the if statement works. But i must run to class. THank you for your help and i will let you know how it goes.