【问题标题】:Getting "The connection to the server was reset while the page was loading" when trying to upload a file to tmp_name尝试将文件上传到 tmp_name 时出现“在页面加载时重置与服务器的连接”
【发布时间】:2013-04-27 18:11:08
【问题描述】:

我正在创建一个将 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>

【问题讨论】:

    标签: php file upload


    【解决方案1】:

    文件对于我的托管服务来说太大了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-05
      • 2021-11-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-04
      • 2018-10-07
      相关资源
      最近更新 更多