我有一个问题,我试图使用PHP上传MP3文件到我的网站。PHP文件上传保持计时
连接/服务器在几秒钟后超时。
这是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>
这里是uploader.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文件。 有什么办法解决这个问题吗?任何帮助将不胜感激!
您尝试存储可由Web服务器写入的图像的文件夹? – j08691 2012-08-09 22:22:29
是的,我认为。我可以上传非常小的文件,但不是几兆字节的大MP3文件。 – Carrotlord 2012-08-09 22:23:29
Web服务器也有自己的限制 - 您使用的服务器和操作系统是什么? – Hoff 2012-08-09 22:25:59