0

I really Dont know What should I do the problem is that $_Files is always empty when I try to upload a file.

<form method="get" action="pic.php" enctype="multipart/form-data">
    <input type="file" name="file">
    <input type="submit" name="submit">
</form>

<?php

$name=$_FILES["file"]["name"];
$tmp_name=$_FILES["file"]["tmp_name"];
echo "php is talking";
echo $name;
if(isset($name)&&!empty($name))
{
    echo "OK";
    $location="uploads/";
    if(move_uploaded_file($name,$location.$name))
    {
        echo "the file has been Uploaded";
    }
}
?>
  • Possible duplicate of [File uploading using GET Method](http://stackoverflow.com/questions/15201976/file-uploading-using-get-method) – splash58 Jun 14 '16 at 14:07

1 Answers1

1

You have to change the HTTP method in the form from GET to POST

<form method="POST" action="pic.php" enctype="multipart/form-data">
lukassteiner
  • 787
  • 1
  • 6
  • 25