Elgg Upload Max

Hello! attempt to modify file upload limit in .htaccess but I can not, my webshoster says he also can not modify it.
then I think you can modify the file plugins.

// Get post_max_size and upload_max_filesize
$ Post_max_size = elgg_get_ini_setting_in_bytes ('post_max_size');
$ Upload_max_filesize = elgg_get_ini_setting_in_bytes ('upload_max_filesize');

// Determine the correct value
$ Max_upload = $ upload_max_filesize> $ post_max_size? $ Post_max_size: $ upload_max_filesize;

---> este this is the code I want to see if you can modify.

$ Upload_limit = elgg_echo ('file: upload_limit', array (elgg_format_bytes ($ max_upload)));

any idea how to put the limit?

  • I'm afraid you can't change the values of upload_max_filesize, post_max_size, max_input_time within a script. The only possibilities to adjust the values for these php variables is either by changing them in .htaccess or in a php.ini.

    Your hoster can suppress the possibility of changing these values in .htaccess or it might not possible to change them due to the server configuration used anyway. On shared servers the hoster might not want to allow larger uploads being possible. The support of your hoster should be able to tell you what the reason is why you can't change the values by modifying .htaccess.

    On VPS or dedicated servers you should be able to change the values in the server-wide php.ini (if you have such a server, ask the support to help you). If you can't modify the server-wide php.ini, it might work to add a php.ini file in the Elgg installation directory and adjust the values by this file. But even in this case I would suggest you first ask the support of your hoster, if this is allowed or not or if it even works or not. If it works but your hoster doesn't allow larger files to be uploaded they might close your account for violating their terms!

  • my hosting server, says he does not know the reason why I can not modify the .htaccess and says that may be my problem.
    I told him that your server will not let me change the .htaccess and says he does not know the reason.

  • The reason it's not working by adjusting the values in .htaccess has nothing to do with Elgg. The reason must be connected with the server setup and/or configuration. I find it a bit strange that the hoster support say that they don't know the reason: either they have a lacking in knowledge of server administration or they simply don't want to tell you. As I already said before, if your server is running with suphp/suexec you simply can't adjust php variables via .htaccess. Or the webserver config on your server might prevent you from changing the values. Especially, if you are on a shared server it's very likely that there are upper limits defined.

    It might work (again: this depends on the server config) to add a directory-specific ini file in the Elgg main folder to define the values. Default name would be .user.ini but it might be different depending on the php config (read more at http://php.net/manual/en/configuration.file.per-user.php).

    Sorry. But I think I can't help you any further. If the support of your hoster is not able or willing to help you and you can't fix it on your own it might be better to look for another hoster as it's simply not an issue connected with the config of Elgg itself.

  • oh I see, thank you very much for your reply

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking