我将使用一个简单的PHP脚本将图像上传到指定的文件夹,但发送文件后出现此错误:
Warning: move_uploaded_file(): Unable to move '/tmp/phpbY8z4A' to 'http://www.yapi-dekorasyon.net/images/Exactly-Sport-According-to-Zodiac.jpg' in /home/pyapitj2/public_html/upload/upload.php on line 8
上传失败
Here is some more debugging info:Array
(
[userfile] => Array
(
[name] => Exactly-Sport-According-to-Zodiac.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpbY8z4A
[error] => 0
[size] => 119217
)
)
的index.php;
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="512000" />
Send this file: <input name="userfile" type="file" />
<input type="submit" value="Send File" />
</form>
upload.php的;
$uploaddir = 'http://www.yapi-dekorasyon.net/images/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo "<p>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
当我尝试使用许多其他脚本将文件上传到网站时,我遇到了类似的错误。如何解决这个问题?
...谢谢
答案 0 :(得分:1)
您正在尝试将文件上传到URL文件夹,而不是像/var/www/vhosts/domain.com/httpdocs/uploads /
这样的路径答案 1 :(得分:0)
这可能是服务器问题而不是脚本吗?