doudilin1225 2016-09-21 00:49
浏览 35
已采纳

从PHP上传获取途径

I have looked around for a solution and have found several of the same brand, but I can't seem to get an exact solution.

I want the image to display, which, in some sense works-partly. It uploads, but no image is displayed. What is the meaning of this?

Here is my PHP code:

<?php
echo <<<_END
<html><head><tite>PHP Form Upload</title></head><body>
<form method='post' action='login.php' enctype='multipart/form-data'>
Select file: <input type ='file' name='filename' size='10'/>
<input type='submit' value='upload'/>
</form>
_END;
if($_FILES){
$name = $_FILES['filename']['name'];
move_uploaded_file($FILES['filename']['tmp_name'],$name);
echo "Uploaded image '$name' <br /> <img src='$name' />"; 
echo "pathway " . $_FILES['filename']['tmp_name'];
}
echo "</body></html>";
?>

Here is my error:

Failed to load resource: the server responded with a status of 404 (Not Found)

Logically, this doesn't make sense to me since when the page is uploaded, my code redirects to the same page and uploads the image with the correct pathway from tmp_name. Well let me know guys

This is what it looks like on the client-side: enter image description here

You cna try it here: http://danny4help.com/login.php

  • 写回答

1条回答 默认 最新

  • dougou6727 2016-09-21 02:21
    关注

    your move_uploaded_file($FILES['filename']['tmp_name'],$name); should be move_uploaded_file($_FILES['filename']['tmp_name'],$name); .

    Underscore is missing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了