Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

empty $_POST and $_FILE variable when uploading large files

Tags:

php

I was trying to upload a file which is 20MB in size. Now default form upload size is 8MB. When I upload such a file i get $_POST and $_FILE variables empty. Now I want to put a check on file size. If I get both these variables empty, how can I put such a check ?? Please give me suggestions

like image 409
Shades88 Avatar asked Dec 07 '25 08:12

Shades88


1 Answers

Barring any code errors, its most likely your 20MB exceeds your upload limit. Change this permanently from your php.ini file.

Use

ini_set("upload_max_filesize", "30M");

to set your max upload size for that session only. And for POST

Use this

ini_set("post_max_size", "30M");

To check the sizes

   echo ini_get("post_max_size") . "\n";
   echo ini_get("upload_max_filesize");
like image 139
Mob Avatar answered Dec 08 '25 22:12

Mob