-1
我正在製作網站以將mp3文件存儲在數據庫中。當我訪問該網站時,它說我已成功連接到數據庫,併成功選擇了數據庫。但是當我選擇一個文件並按上傳按鈕時,它會嘗試連接很長時間,然後我的網絡瀏覽器顯示「加載頁面時服務器的連接已重置」註釋掉的代碼不起作用。編輯:這可能是相關的,我正在使用託管服務。嘗試將文件上傳到tmp_name時,「正在加載頁面時重置了」服務器的連接重置「
<!DOCTYPE html>
<!-- HTML5 style -->
<html lan="en">
<head>
<title>Upload Music</title>
<meta charset="utf-8" />
</head>
<body>
<form action="UploadMusic.php" method="POST" enctype="multipart/form-data">
File:
<input type="file" name="music"/> <input type="submit" value="Upload"/>
</form>
<?php
$DBConnect = mysql_connect("replaced", "for", "privacy");
if ($DBConnect === FALSE) {
echo "Did not successfully connect to the database server." .
"<p>Error code " . mysql_errno()
. ": " . mysql_error() . "</p>";
}
else {
echo "<p>Successfully connected to the database server</p>";
if (mysql_select_db("replaced") === FALSE) {
echo "Did not successfully select the database";
}
else {
echo "Successfully selected the database";
/*$file = $_FILES["music"]["tmp_name"];
echo $file;
if (!isset($file)) {
echo "Please select a mp3 file to upload";
}
else {
$music = file_get_contents($_FILES["music"]["tmp_name"]);
echo $music;
}
*/
}
}
?>
</body>
</html>