以下是上传页面的主页面:
<form id="form1" method="post" action="display.php" enctype="multipart/form-data" id="pro_image">
<input type='file' onchange="readURL(this);" name="image" id="image"/>
<br><img id="blah" src="profile pic.jpg" alt="your image" width="160px" height="120px"/><br/>
</form>
并入图片显示页面(display.php)脚本:
<?php
$dir="upload/";
$name=$_FILES['image']['name'];
$tmp=$_FILES['image']['tmp_name'];
move_uploaded_file($tmp,$dir.$name);
?>
<br /><img src="".$dir.$name."" width="100" height="100"/>
任何人都可以帮助我指出 display.php
上的实际问题并更正我的脚本?图像没有按预期在页面上显示。
display.php 的输出如上所示:
最佳答案
你忘了<?php ?>
这里
<img src="<?php echo $dir.$name; ?>" width="100" height="100"/>
关于php - 为什么我上传的图片没有显示在我的 php 页面上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16353353/