簡體   English   中英

PHP上傳文件錯誤代碼8

[英]PHP upload file error code 8

我有一個表格,可以很好地處理(上傳)許多圖像文件,並且大小不同。

但是某些圖像未上載到服務器。

問題映像的$ _FILE [name] [tmp_name]$ _FILE [name] [error] == 8為

同時,其他圖像(文件大小更大或更小)可以正確上傳。

你有什么想法嗎?


謝謝。

print_r($_FILES) for normal image

FILES:Array
(
    [img] => Array
        (
            [name] => Array
                (
                    [0] => 1320600215_0_284da_78d5c77a_xl.jpg
                )

            [type] => Array
                (
                    [0] => image/jpeg
                )

            [tmp_name] => Array
                (
                    [0] => /var/www/test/data/mod-tmp/phpoqm4qR
                )

            [error] => Array
                (
                    [0] => 0
                )

            [size] => Array
                (
                    [0] => 126867
                )

        )

)



print_r($_FILES) for problem image
FILES:Array
(
    [img] => Array
        (
            [name] => Array
                (
                    [0] => 94689121_1GPPZgCqPmI.jpg
                )

            [type] => Array
                (
                    [0] => 
                )

            [tmp_name] => Array
                (
                    [0] => 
                )

            [error] => Array
                (
                    [0] => 8
                )

            [size] => Array
                (
                    [0] => 0
                )

        )

)

嗨,錯誤代碼8表示:

 UPLOAD_ERR_EXTENSION

    Value: 8; A PHP extension stopped the file upload. PHP does not provide a way to ascertain which extension caused the file upload to stop; examining the list of loaded extensions with phpinfo() may help. Introduced in PHP 5.2.0.

可能有幫助的事情:

  1. 檢查您的服務器是否安裝了一些額外的安全模塊,這些模塊可能會限制文件上傳(例如Suhosin會帶來很多此類問題)

  2. 檢查您的max_upload_filesize和post_max_size參數是否正確設置

  3. 嘗試檢查此問題是否發生在某些特定文件(例如,大文件,某些擴展名或某些文件名)或完全隨機的情況下

            if (isset($_FILES['files']) && !empty($_FILES['files'])) 
             {
                  date_default_timezone_set("asia/kolkata");
                  $image=date("YmdHis")."_".$_FILES['files']['name'];
                  move_uploaded_file($_FILES['files'] 
                  ['tmp_name'],"uploads/business/".$image);
             }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM