dongmu1989 2017-11-17 06:45 采纳率: 0%
浏览 8
已采纳

并非所有选定的图像都在$ _FILES中

This is a strange one. I have an upload function that uploads all selected images from the client's computer to the server. This is working, however, when selecting a large number of images it cuts off after 19 images. I tried uploading 71 images and every time I check the number of images in $_FILES it only contains 19. Has anyone had this issue before? See my code below:

HTML

<input type="file" webkitdirectory mozdirectory msdirectory odirectory directory multiple class="" id="image_folder" name="image_folder[]" value=""  style="display: none;"/>

PHP

//Upload book images
            if (count($_FILES['image_folder']['name']) > 0) {
                for($file = 0; $file < count($_FILES['image_folder']['name']); $file++) {
                    //Get the temp file path
                    $tmpFilePath = $_FILES['image_folder']['tmp_name'][$file];

                    //Make sure we have a filepath
                    if ($tmpFilePath != "") {

                        //save the filename
                        $shortname = $_FILES['image_folder']['name'][$file];

                        $directoryName = "../Authors/AUT".sprintf("%09d", $AUT_ID)."/Content/";

                        //Check if the directory already exists.
                        if (!is_dir($directoryName)) {
                            mkdir($directoryName, 0755, true);
                        }

                        //save the url and the file
                        $filePath = "../Authors/AUTH".sprintf("%09d", $AUTH_ID)."/Content/".$shortname;

                        //Upload the file into the dir
                        if (move_uploaded_file($tmpFilePath, $filePath)) {
                            //TODO:: Save path to database.

                        }
                    }
                }
            }

So like I said, my code works and 19 images are uploaded out of the total 71. I have checked my Server's max execution time as well and amended it. However, it still makes no difference. Besides, I don't think it has something to do with that as the total count of Images in $_FILES are is only 19 instead of 71.

  • 写回答

2条回答 默认 最新

  • dongping2023 2017-11-17 06:47
    关注

    Increase max_file_uploads limit in your php.ini file.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测