【发布时间】:2011-10-14 05:53:28
【问题描述】:
我从 php.net 获取了这个基本的上传文件脚本,它在将图像移动到目录之前给出了两个警告。
警告: move_uploaded_file(public_html/your/inventory_images/penguin.jpg) [function.move-uploaded-file]:打开流失败:没有这样的文件或 /home3/ny/public_html/your/anotherformsale.php 第 73 行中的目录
警告:move_uploaded_file() [function.move-uploaded-file]:无法 将“/var/tmp/phpnIxYMK”移动到 'public_html/your/inventory_images/penguin.jpg' 在 /home3/ny/public_html/your/anotherformsale.php 第 73 行
我在尝试使用下面的基本 move_upload 脚本上传图像后收到此警告。
<?php
$uploaddir ='public_html/your/inventory_images/';//<----This is all I
changed $uploadfile = $uploaddir . basename($_FILES['file']['name']);
echo '<pre>'; if (move_uploaded_file($_FILES['file']['tmp_name'],
$uploadfile)) {
echo "File is valid, and was successfully uploaded.\n"; } else {
echo "Possible file upload attack!\n"; }
echo 'Here is some more debugging info:'; print_r($_FILES);
print "</pre>";
?>
【问题讨论】:
-
文件夹
public_html/your/inventory_images是否作为.php 的相对路径存在? -
标签: php file-upload