.htaccess - max upload size php with symfony2 -
i have form file input post iframe.
<form id="uploadform" enctype="multipart/form-data" action="{{ path('lesson_upload') }}" target="uploadframe" method="post"> <label for="uploadfile">image :</label> <input id="uploadfile" name="uploadfile" type="file" /> <br /><br /> <input class="btn btn-primary" id="uploadsubmit" type="submit" value="upload" /> </form> <div id="uploadinfos"> <div id="uploadstatus">aucun upload en cours</div> <iframe hidden id="uploadframe" name="uploadframe"></iframe> </div>
it seems there upload size limit of 2m.
i have edited php.ini increase limit. , there no limitation on .htaccess.
is there limitation due symfony ?
maybe configuration file ?
edit : php script
public function lessonuploadaction(request $request) { $error = null; $filename = null; $em = $this->getdoctrine()->getmanager(); if (isset($_files['uploadfile']) && $_files['uploadfile']['error'] === 0) { $filename = pathinfo($_files['uploadfile']['name'])['filename']; $ext = pathinfo($_files['uploadfile']['name'])['extension']; // on déplace le fichier depuis le répertoire temporaire vers $targetpath $doc = new document(); $doc->setname($filename); $doc->setauthor($this->getuser()); $now = new \datetime(); $doc->setdate($now); $em->persist($doc); $em->flush(); $targetpath = getcwd() . '/ressources/library/documents/' . $doc->getslug() . '.' . $ext; if (@move_uploaded_file($_files['uploadfile']['tmp_name'], $targetpath)) { $error = 'ok'; } else { $error = "Échec de l'enregistrement !"; } } else { $error = 'aucun fichier réceptionné !'; } return new jsonresponse($this->container->get('jms_serializer')->serialize(['name' => $filename, 'slug' => $doc->getslug(), 'ext' => $ext], 'json')); // doublement jsonifié ? }
thanks,
you need ensure maximum size limit of on post request well.
post_max_size
this value need enlarged in php.ini file, try , check that. have @ this question.
Comments
Post a Comment