PHP 文件上传不断超时


PHP File Upload Keeps Timing Out

我有一个问题,我尝试使用 PHP 将 MP3 文件上传到我的网站。

连接/服务器在几秒钟后超时。

这是 PHP 上传表单的 HTML 代码:

<html>
<head>
<title>Upload Music</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>
<br />
<div class="center">
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
</div>
</html>

这是上传者.php文件:

<head>
<title>Success!</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" />
</head>
<div class="center">
<br />
<?php
set_time_limit(1000000);
$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!";
}
file_put_contents("uploads.txt", basename( $_FILES['uploadedfile']['name']), 
FILE_APPEND);
?>
</div>
</html>

这是我的php.ini文件:
upload_max_filesize = 2000M post_max_size = 2000M memory_limit = 2000M max_input_time = 1000000000 max_execution_time = 1000000000

我检查了phpinfo(),看起来我的php.ini文件被正确读取。有什么办法可以解决这个问题吗?任何帮助将不胜感激!

忽略上传者.php文件中的 HTML 注释。他们不应该在那里。

好的,

我想通了。我的虚拟主机不允许我上传大于 5MB 的文件...这有点糟糕,但我想我会使用外部托管。