2012-08-09 60 views
0

我有一個問題,我試圖使用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文件。 有什麼辦法解決這個問題嗎?任何幫助將不勝感激!

+0

您嘗試存儲可由Web服務器寫入的圖像的文件夾? – j08691 2012-08-09 22:22:29

+0

是的,我認爲。我可以上傳非常小的文件,但不是幾兆字節的大MP3文件。 – Carrotlord 2012-08-09 22:23:29

+0

Web服務器也有自己的限制 - 您使用的服務器和操作系統是什麼? – Hoff 2012-08-09 22:25:59

回答

0

忽略uploader.php文件中的HTML註釋。他們不應該在那裏。

0

好吧我想通了。我的網絡主機不讓我上傳大於5MB的文件...這有點糟糕,但我想我會使用外部託管。