Image Validation


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if($_FILES['logo']['name']!='') {
  2. $img = explode('.', $_FILES['logo']['name']);
  3. $img_path = $img_dir.'/logo'.$img[1];
  4. $extension = strtolower($img[1]);
  5. if(in_array($extension , array('jpg','jpeg', 'gif', 'png', 'bmp'))){
  6. move_uploaded_file($_FILES['logo']['tmp_name'], $img_path);
  7. update_site_option('rt_blog_thumb', $blog_thumb);
  8. }
  9. else echo 'Invalid file';
  10. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.