Search code examples
phphtmlformsfile-upload

Firefox and Edge won't upload more than one image


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


Solution

  • 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