我在基于窗口的服务器上上传图像时出错,它在 localhost 和 linux 服务器上运行良好。首先,我在根目录中手动创建一个名为photos的文件夹和两个名为 imageupload.php和index.php的文件
where code is
索引.php
<html>
<body>
<form enctype="multipart/form-data" action="imageupload.php" method="post">
Choose Picture:<input type="file" name="photo"/>
<input name="submit" type="submit" value="save"/>
</form>
</body>
</html>
图像上传.php
<?php
if(isset($_REQUEST['submit'])){
$target = "photos/";
$finallink = $target.basename($_FILES['photo']['name']);
if(move_uploaded_file($_FILES['photo']['tmp_name'], $finallink))
{
echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
}
?>
这段代码在 localhost 和 linux 服务器上运行良好,但我购买了一个基于窗口的主机,因为在基于窗口的 web 服务器上运行这段代码时出现错误。
抱歉,上传您的文件时出现问题。
如何解决?这个问题是在基于窗口的服务器上运行的 php 代码还是其他任何东西?提前感谢您的帮助。