problem file_max_size

See all posts Reply

problem file_max_size new!
by mcpalls, 10 years, 4 months ago
hi, i have a problem with $handle->file_max_size don't work

this is my code
$handle = new Upload($file);
if ($handle->uploaded) {
  $handle->file_max_size = '3145728';
  $handle->Process("./uploads");
  if ($handle->processed) {

this is the error:

[00:37:27.259] "{"readyState":4,"responseText":"array(5) {\n [\"name\"]=>\n array(1) {\n [0]=>\n string(8) \"rami.jpg\"\n }\n [\"type\"]=>\n array(1) {\n [0]=>\n string(0) \"\"\n }\n [\"tmp_name\"]=>\n array(1) {\n [0]=>\n string(0) \"\"\n }\n [\"error\"]=>\n array(1) {\n [0]=>\n int(1)\n }\n [\"size\"]=>\n array(1) {\n [0]=>\n int(0)\n }\n}\nFile not uploaded on the server Error: File upload error (the uploaded file exceeds the upload_max_filesize directive in php.ini).","status":200,"statusText":"OK"}"

the size of rami.jpg is 2,1M

other info:

system information
- class version : 0.32
- operating system : Linux
- PHP version : 5.2.6
- GD version : 2.0.34
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- upload_max_filesize : 2M (2097152 bytes)
- language : en_GB


tnk yReply
Re: problem file_max_size new!
by colin, 10 years, 4 months ago
$handle->file_max_size allows you to set a limit that the class can enforce.

However, the error message suggests that you have a limit set in your php.ini file: upload_max_filesize. You can see its value with phpinfo().

So what happens in your case is that the web server refuses the file because of the limit in your php.ini, well before the class has a chance to check the filesize against $handle->file_max_sizeReply
Re: problem file_max_size new!
by mcpalls, 10 years, 4 months ago
ok tnk,
I thought that max_filesize resetup the php.ini limitReply