Error on if script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Error on if script

Post 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
jaxn
Forum Commoner
Posts: 55
Joined: Fri Jan 16, 2004 1:50 pm
Location: Nashville, TN

Post 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
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post 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.
Post Reply