File doesn't upload to localhost via PHP

前端 未结 4 1409
傲寒
傲寒 2021-01-15 03:42

I cannot upload file to localhost using PHP. I have created simple html form and php script. However I get these error messages.

\'import.html\'

<         


        
4条回答
  •  囚心锁ツ
    2021-01-15 04:30

    Well, according to your localhost directories you can try this:

    if (!file_exists("teecom/upload"))
    {
        mkdir("teecom/upload", 0777, true);
    }
    if (file_exists("teecom/upload/" . $_FILES["import"]["name"]))
    {
        echo $_FILES["import"]["name"] . " already exists. ";
    }
    else
    {
        move_uploaded_file($_FILES["import"]["tmp_name"],
        "teecom/upload/" . $_FILES["import"]["name"]);
        echo "Stored in: " . "upload/" . $_FILES["import"]["name"];
    }
    

提交回复
热议问题