Php 获得;加载页面时,与服务器的连接被重置";尝试将文件上载到tmp_name时
我正在制作一个网站,在数据库中存储mp3文件。当我访问该站点时,它显示我成功连接到数据库,并且成功选择了数据库。但是,当我选择一个文件并按下上载按钮时,它会尝试连接很长一段时间,直到我的web浏览器显示“页面加载时服务器的连接被重置”注释掉的代码不起作用。编辑:这可能与我使用的托管服务有关Php 获得;加载页面时,与服务器的连接被重置";尝试将文件上载到tmp_name时,php,file,upload,Php,File,Upload,我正在制作一个网站,在数据库中存储mp3文件。当我访问该站点时,它显示我成功连接到数据库,并且成功选择了数据库。但是,当我选择一个文件并按下上载按钮时,它会尝试连接很长一段时间,直到我的web浏览器显示“页面加载时服务器的连接被重置”注释掉的代码不起作用。编辑:这可能与我使用的托管服务有关 <!DOCTYPE html> <!-- HTML5 style --> <html lan="en"> <head> <title>Upload
<!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>
上传音乐
文件:
文件大小对于我的托管服务来说太大
<!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>