If No Image { }

See all posts See thread Reply

Re: If No Image { } new!
by Dan Slinky, 17 years, 4 months ago
something like this

if no image is posted {
   insert query with NO image
} else {
   upload image
   insert query with image
}
Reply
Re: If No Image { } new!
by colin, 17 years, 4 months ago
Something like this maybe?

$handle = new upload($_FILES['image_field']);
if ($handle->uploaded) {
  if ($handle->file_is_image) {
    // file is an image
    $handle->image_resize = true;
    $handle->image_x = 200;
    $handle->process('Test');
    if ($handle->processed) {
      echo 'file uploaded';
      $handle->clean();
    } else {
      echo 'error : ' . $handle->error;
    }
  } else {
    // file is not an image
    $handle->clean();
  }
}
Reply