这是我在我的服务器上测试的脚本,它说文件上传失败。但是当我在不同的服务器上尝试时它可以工作。有谁知道这与我的 php.ini 设置有关还是...
<form enctype="multipart/form-data" action="fupload.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>
<?php
$uploaddir = '/var/www/vhosts/costsave.net.au/httpdocs/uploads/';
$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>";
?>
错误