【发布时间】:2018-04-30 21:14:53
【问题描述】:
这是一个奇怪的问题。我有一个上传功能,可以将所有选定的图像从客户端计算机上传到服务器。 This is working, however, when selecting a large number of images it cuts off after 19 images.我尝试上传 71 张图片,但每次检查 $_FILES 中的图片数量时,它只包含 19 张。以前有人遇到过这个问题吗?请参阅下面的代码:
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.
}
}
}
}
就像我说的,我的代码有效,总共 71 张图片中上传了 19 张图片。我还检查了我的服务器的最大执行时间并对其进行了修改。但是,它仍然没有任何区别。此外,我认为这与此无关,因为 $_FILES 中的图像总数只有 19 个而不是 71 个。
【问题讨论】:
标签: php