upload_max_filesize is stuck at 2M although I have set in the correct php.ini file to 50M [closed]

I have to read data from multiple csv files.

I therefore retrieve the data via a form linked to my entity.

My files are 90Ko, 6Mo and 17Mo.

Yes, I have correctly set the PHP.INI file, my settings are indeed present when I look in phpinfo () but I still have the limit which is always 2M when i try to upload my csv.

Are there any special settings to make when using symfony’s createFormBuilder?

All I can find in answer is to sort out:
upload_max_filesize
post_max_size
memory_limit

that I have already set extremely high but the limit remains at 2M when I do a dump(ini_get ('upload_max_filesize'));

and of course, I have restart the server

I do not know where to look, knowing that I have looked around the options that I know.

EDIT :

the problem is that I cannot import my data on the database because of the import limit

 $formPalmier = $this->createFormBuilder()
        ->add('formPalmier', FileType::class, [
            'attr' => ['accept' => '.csv'],
            'label' => 'Import Palmier'
        ])
        ->getForm();

        $formPalmier->handleRequest($request);

        if ($formPalmier->isSubmitted() && $formPalmier->isValid()) {

            /** 
             * @var UploadedFile
             */
            $file = $formPalmier->get('formPalmier')->getData();  
            
            if (($handle = fopen($file->getPathname(), "r")) !== false) {

                $count = 0;
                while (($data = fgetcsv($handle, 0, ";")) !== false) {

                $count++;
                if ($count == 1) { continue; }

                $entity = new Palmier();

                $entity->setNumeroAffaire($data[0]);                //string
                
                $num1 = (int)$data[1];
                $entity->setCodeInseeImportPalmier($num1);//integer

                $num2 = (int)$data[2];
                $entity->setCodeCentreImportPalmier($num2);//integer

                $entity->setNatureEtiImportPalmier($data[3]);                //string

                $entity->setPoseDepose($data[4]);                //string


                $date5 = explode("/", $data[5]);                    //transformation en date
                $DateService = '"'.$date5[2].'-'.$date5[1].'-'.$date5[0].'"';
                $DateService = DateTime::createFromFormat('Y-m-d',$DateService);
                $entity->setDateMiseServiceHorsServiceImportPalmier($DateService);

                $num6 = (int)$data[6];
                $entity->setLongueurIrisImportPalmier($num6);

                $float7 = (float)$data[7];
                $entity->setLongueurSigImportPalmier($float7);

                $em->persist($entity);

                }
                fclose($handle);
                $em->flush();
            }

            return $this->redirectToRoute('import');
        }

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *