英文:
Firefox and Edge won't upload more than one image
问题
我已经创建了一个测试页面,以重构我的fileManager类。我的问题是,无论是Firefox还是Edge,都无法上传多个图像。如果我选择多个图像,没有任何内容被传递。没有$_POST,没有$_FILES,什么都没有。以下是我简单的HTML和我正在测试的fileManager类的开始脚本:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Restricted</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" name="form">
<input type="text" name="username" placeholder="username">
<input type="file" multiple name="lFront[]" placeholder="Left Front">
<input type="file" multiple name="rFront[]" placeholder="Right Front">
<input type="file" multiple name="lRear[]" placeholder="Left Rear">
<input type="file" multiple name="rRear[]" placeholder="Right Rear">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
<?php
include_once('includes/fileManager.php');
include_once('config.php');
$root = dirname(__FILE__).'\';
if ( isset ( $_POST['submit'] ) ) {
$file = new fileManager($root.'clientImages\', 'testfolder' , "testfolder1");
$file->uploadFile($_FILES['rFront']);
$file->uploadFile($_FILES['lFront']);
$file->uploadFile($_FILES['rRear']);
$file->uploadFile($_FILES['lRear']);
}
var_dump($_POST); // 如果我尝试上传多个图像,则此提交后不输出任何内容
?>
这是我的uploadFile
函数,如果上传多个图像,var_dump
始终为空:
public function uploadFile($file, $webp = NULL) {
echo '在uploadFile<br>';
var_dump($file);
if ( !is_array($file) ) return false;
// 用于存储所有图像名称的数组
$stringName = array();
}
我会感激任何帮助或建议。
我查找了为什么响应被截断的原因。进入Firefox的about:config并将devtools.netmonitor.responseBodyLimit
更改为0。这没有产生任何结果。这是一个纯粹的HTML问题。我不知道为什么它们不会上传。
英文:
I have created a test page in order to revamp my fileManager class. My problem is that neither Firefox nor Edge are uploading more than one image. If I select more than one image nothing is being passed. No $_POST,no $_FILES, nothing. Here is my simple HTML and the begining script of my fileManager class I'm testing:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Restricted</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" enctype="multipart/form-data" name="form">
<input type="text" name="username" placeholder="username">
<input type="file" multiple name="lFront[]" placeholder="Left Front">
<input type="file" multiple name="rFront[]" placeholder="Right Front">
<input type="file" multiple name="lRear[]" placeholder="Left Rear">
<input type="file" multiple name="rRear[]" placeholder="Right Rear">
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>`
<?php
include_once('includes/fileManager.php');
include_once('config.php');
$root = dirname(__FILE__).'\\';
if ( isset ( $_POST['submit'] ) ) {
$file = new fileManager($root.'clientImages\\', 'testfolder' , "testfolder1");
$file->uploadFile($_FILES['rFront']);
$file->uploadFile($_FILES['lFront']);
$file->uploadFile($_FILES['rRear']);
$file->uploadFile($_FILES['lRear']);
}
var_dump($_POST); // This outputs nothing after for submission if I have more than one image trying to upload
?>`
This is my uplodFile function and the var_dump is always empty if more than one image is uploaded
public function uploadFile($file, $webp = NULL) {
echo 'In uploadFile<br>';
var_dump($file);
if ( !is_array($file) ) return false;
// To store all of the image names
$stringName = array();
}
I would appreciate any help or advice
I have looked up why the response was being truncated. went into firefox's about:config and changed devtools.netmonitor.responseBodyLimit to 0. That did not render any results. This is a straight html issue. I have no idea why they won't upload
答案1
得分: 1
CBroe是正确的。谢谢。这是一个php.ini的问题。
"> 您可能遇到了与您上传的数据量相关的POST请求大小限制之一。
"> php.net/manual/en/ini.core.php#ini.post-max-size: "如果post数据的大小大于post_max_size,则$_POST和$_FILES
"> 超级全局变量将为空。"
- CBroe
7小时前
英文:
CBroe was correct. Thank you. It was a php.ini issue
> You are probably running into one of the POST request size related
> limits here, with the amount of data you are uploading.
> php.net/manual/en/ini.core.php#ini.post-max-size: "If the size of post
> data is greater than post_max_size, the $_POST and $_FILES
> superglobals are empty."
- CBroe
7 hours ago
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论