Help with this script

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
php-forum Active User
php-forum Active User
Posts: 300
Joined: Sun Dec 11, 2011 12:51 am
Location: Shrewsbury, Shropshire

Tue Mar 05, 2013 12:00 am

This error means you are missing a closing }. I found where it was but have combined your first 2 if statements anyway to save lines of code for you:

Code: Select all

if (isset($name) && !empty($name)) {

  if (($extension=='jpg'||$extension=='jpeg') && $type=='image/jpeg' && $size<=$max_size) {

    $location ='uploads/';

    if (move_uploaded_file($tmp_name, $location.$name)) {
      echo 'Uploaded!';
    }  else {
      echo 'There was an error';

  } else {
  echo 'File must be a jpg/jpeg and must be 2mb or less';

} else {
  echo 'Please chooose a file.';

Post Reply