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.

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

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站