Loading photo input type="file"



  • There's a Html form:

    <form method="post" action=""/>
        <input  required="required" name="image" type="file"   />
        <input type="submit"/>
    </form>
    

    php code:

    if(isset($_FILES['image'])){
        $uploaddir = '../images/articles/';       
        $prev = $uploaddir.basename($_FILES['image']['name']);
         copy($_FILES['image']['tmp_name'], $prev);
    }
    

    He sees. $_POST['image']I can't see. $_FILES['image']What's the reason?



  • Add to form: enctype="multipart/form-data."

    <form method="post" enctype="multipart/form-data" action=""/>
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2