[eluser]JoostV[/eluser]
Hi all,
I am looking for code to change maximum size for uploads on-the-fly. I would like to accept posting of video files up to 20MB by one special user. All other users will have to make do with the default php.ini settings.
The default settings are:
post_max_size = 8M
upload_max_filesize = 2M
I added this code to the constructor of my controller, but I still can't post files that exceed my .ini limits. Upload class returns error 'The uploaded file exceeds the maximum allowed size in your PHP configuration file.'.
Code:
$this->data['max_size'] = 20; // Set new upload size, in megabytes
$this->data['max_size'] *= 1024 *1024; // Convert to bytes
// Temporarily change max upload settings
ini_set('post_max_size', $this->data['max_size']);
ini_set('upload_max_filesize', $this->data['max_size']);
What am I doing wrong? Is it at all possible to temporarily change max upload size? I would rather not change php.ini settings.