上传文件时整个网站崩溃

Whole website crashes when I upload a file

当我使用 HTML 表单上传文件时,只要我点击 "upload" 按钮,整个网站就会崩溃。我有大约 40 分钟看不到该网站,但 FTP 服务器仍然可用。

我不明白为什么会这样。昨天它工作正常,今天它没有。什么都没有改变。

我使用了一个简单的表格:

<form enctype="multipart/form-data" action="csvupload.php" method="POST">
 <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Upload File: <input name="csv" type="file" />
<input type="submit" value="Send File" />
 </form>

您的 php 文件上传错误捕获情况如何? 我发现这样的代码在这些崩溃情况下可以提供信息。

$file=$_FILES['file'];
        if (isset($_FILES['file'])==true){
            if ($file["error"] > 0)
            {
                $errors_array = array(  0=>"There is no error, the file uploaded with success", 
                    1=>"The uploaded file exceeds the upload_max_filesize directive!", 
                    2=>"The uploaded file exceeds the MAX_FILE_SIZE directive",
                    3=>"The uploaded file was only partially uploaded", 
                    4=>"No file was uploaded",
                    5=>"Unknown Error",
                    6=>"Missing temporary folder"
                );
                $error=$file["error"];

            }
    }

阻止 move_uploaded_file 被执行。

我发现了问题...当我处理我的代码时,我复制并过去了失败,所以 for 循环处于无限循环中。 捂脸