If No Image { }

See all posts Reply

If No Image { } new!
by Dan Slinky, 17 years, 4 months ago
If there is no image added in the form, I'd like to still do some actions, but ignore the upload alltogether. I've been battling away but to no avail. Clues?Reply
Re: If No Image { } new!
by colin, 17 years, 4 months ago
I don't understand what you mean. Could you elaborate? You can paste your code here, and the log of the class.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