上传图片出错,这段代码我以前用的时候没报错
<!DOCTYPE html><br /><html><br /> <head><br /> <meta charset=utf-8/><br /> <title>War-game -Add Your score</title><br /> </head><br /> <body><br /> <h2>War game - add your score</h2><br /> <?php<br /> <br /> <br /> include 'error_report.php';<br /> $photo_dir='images/';<br /><br /><br /> if(!empty($_POST['submit']))<br /> {<br /> $first_name=$_POST['first_name'];<br /> $last_name=$_POST['last_name'];<br /> $score=$_POST['score'];<br /> if(!file_exists($photo_dir))<br /> {<br /> mkdir($photo_dir);<br /> }<br /> if($_FILES['image_upload']['error']>0)<br /> {<br /> echo 'Error:'.$_FILES['image_upload']['error'].'<br/>';<br /> }<br /> else{<br /> $dbc=mysqli_connect('localhost','root','pengyu2408','score_list')or die('error in connet');<br /> $query="INSERT INTO score_lis(first_name,last_name,score) VALUES('$first_name','$last_name','$score')";<br /> mysqli_query($dbc,$query)or die('error_2');<br /> $gpy=move_uploaded_file($_FILES['image_upload']['tmp_name'],$photo_dir.$_FILES['image_upload']['name']);<br /> <br /> echo '<p>thanks for adding your new high score!</p>';<br /> echo '<p><strong>FIRST_NAME:</strong>'.$first_name.'<br/>';<br /> echo '<strong>LAST_NAME:</strong>'.$last_name.'</p>';<br /> echo '<p><strong>Score:</strong>'.$score.'<br/></p>
<div class="aritcle_card">
<a class="aritcle_card_img" href="/ai/2025">
<img src="https://img.php.cn/upload/ai_manual/000/000/000/175679997460635.png" alt="挖错网">
</a>
<div class="aritcle_card_info">
<a href="/ai/2025">挖错网</a>
<p>一款支持文本、图片、视频纠错和AIGC检测的内容审核校对平台。</p>
<div class="">
<img src="/static/images/card_xiazai.png" alt="挖错网">
<span>28</span>
</div>
</div>
<a href="/ai/2025" class="aritcle_card_btn">
<span>查看详情</span>
<img src="/static/images/cardxiayige-3.png" alt="挖错网">
</a>
</div>
';<br /> echo '<img src="' . $photo_dir. $_FILES['image_upload']['name']. '" alt="上传图片出错,这段代码小弟我以前用的时候没报错" >';<br /> echo '<p><a href="index_1.php"><<Back to hight score</a></p>';<br /> //clear the score data to clear the form<br /> $firet_name="";<br /> $last_name="";<br /> mysqli_close($dbc);<br /> }<br /> }<br /> ?><br /> <hr /><br /> <form entype="multipart/form-data" method ="post" action="<?php echo $_SERVER['PHP_SELF'];?>"><br /> <label for="name">FIRST NAME:</label><br /> <input type="text" id="first_name" name="first_name" /><br /><br /> <label for="name">LAST NAME:</label><br /> <input type="text" id="last_name" name="last_name"/><br /><br /> <label for="score">Score:</label><br /> <input type="text" id="score" name="score"/><br /><br /> <input type="file" id="image_upload" name="image_upload"/><br /><br /> <hr /><br /> <input type="submit" value="ADD" name="submit"/><br /> </form><br /> </body><br /></html><br />
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号