1

I cannot get this to work am I doing something wrong?

  $extensions= array("jpeg","jpg","png");

  if(in_array($file_ext,$extensions)=== false){
     $errors[]="extension not allowed, please choose a JPEG or PNG file.";
  }

  if($file_size > 2097152) {
     $errors[]='File size must be excately 2 MB';
  }

  if(empty($errors)==true) {
     move_uploaded_file($file_tmp,"images/".$file_name);
     echo "Success";
  }else{
     print_r($errors);
  }

} ?>

  <form action = "" method = "POST" enctype = "multipart/form-data">
     <input type = "file" name = "image" />
     <input type = "submit"/>

     <ul>
        <li>Sent file: <?php echo $_FILES['image']['name'];  ?>
        <li>File size: <?php echo $_FILES['image']['size'];  ?>
        <li>File type: <?php echo $_FILES['image']['type'] ?>
     </ul>

  </form>

closed as off-topic by John Conde Sep 17 at 17:25

  • This question does not appear to be about webmastering within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • "I cannot get this to work". In what sense? What do you try precisely and what result did you get vs what did you expected? – Patrick Mevzek Sep 17 at 15:27
  • This question appears to be off-topic because it is about web development which is off-topic at Pro Webmasters. Web development questions may be asked at Stack Overflow but be sure to read their FAQ before posting to ensure your question meets their guidelines. In its current form, this question does not meet their guidelines. – John Conde Sep 17 at 17:25

Browse other questions tagged or ask your own question.