PHP:没有指定输入文件

时间:2011-08-11 15:11:46

标签: php

使用http://www.tizag.com/phpT/fileupload.php中的示例。 我在godaddy使用PHP 5.3

我使用上面的示例“未指定输入文件”来获取此错误。

当我点击“上传文件”按钮时,我在序列中收到错误。

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>

<?php
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
   echo "There was an error uploading the file, please try again!";
}
?>

upload.php和upload-file.html都在同一个目录中。

我在那里有“uploads”目录

1 个答案:

答案 0 :(得分:0)

快速谷歌消息,看起来你可能从PHP获取消息作为Apache CGI,因为'uploader.php'不存在或与HTML表单不在同一目录中 - 什么您的文件是否被调用以及它们在服务器上的路径是什么?

请参阅&lt; form&gt;的'action'属性HTML文件的元素。

相关问题