Posted By

ksantoshp on 11/26/09


Tagged

image validation


Versions (?)

Image Validation


 / Published in: PHP
 

  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  

You need to login to post a comment.