我正在制作一个将mp3文件存储在数据库中的网站。当我去网站时,它说我成功连接到数据库并且我成功选择了数据库。但是当我选择一个文件并按下上传按钮时,它会尝试连接很长一段时间,然后我的网络浏览器显示“在页面加载时重置了与服务器的连接”注释掉的代码不起作用。编辑:我正在使用托管服务可能是相关的。
<!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>
答案 0 :(得分:0)
文件大小对于我的托管服务来说太大了。