上传文件时整个网站崩溃了

时间:2015-03-30 17:14:38

标签: php html file-upload crash

当我使用HTML表单上传文件时,只要我按下"上传"按钮,整个网站崩溃。我无法看到网站大约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>

2 个答案:

答案 0 :(得分:0)

你的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。

答案 1 :(得分:0)

我发现了问题......当我处理我的代码时,我制作了一份副本&amp;过去失败所以for循环处于无限循环中。 捂脸