English Yacs handbook Software installation and upgrade

How to overcome upload limitations?

YACS allows for file attachments, and usual server settings are adequate for common use. However, in some situations you would like to cross boundaries.

[title]Change PHP settings[/title] The most common cause of problems related to file uploads is PHP itself. The following php.ini settings effect file uploads:

[*] file_uploads

This parameter has to be set to 1 to accept file uploads, value 0 is to not accept file uploads. Defaults to 1

[*] post_max_size

This is the maximum size of a POST request that PHP will accept. The default for PHP 4.3.x is 8M. If the file(s) you are trying to upload have a single or combined size over this value, PHP will exit. This affects the total post data. For example, if this were set to 8M and you are uploading four 3M files, PHP would not accept the files. You could, however, upload the four 3M files individually without a problem from this setting.

[*] upload_max_filesize

This is the maximum size of an individual uploaded file. The default for PHP 4.3.x is 2M.

[*] max_input_time

This is the maximum time PHP will accept input in seconds. The default for PHP 4.3.x is 60.

You may see all your current ini settings using the script, included with YACS, called control/info.php.

For more information see PHP's file upload documentation at Common Pitfalls

According to PHP techical documentation, some parameters of the PHP.INI file may be changed from within a script, by calling function ini_set(), including the infamous parameter upload_max_filesize.

However, this change would be inoperant, because the script is called [i]after[/i] the upload, meaning call to ini_set() would be too late anyway.

Therefore, it is useless to attempt to fix this issue from within PHP scripts.

[title]Change Apache settings[/title] If you do not have access to change php.ini and your website is running on apache, you may be able to include these settings in an .htaccess file. This is only possible if "AllowOverride Options" or "AllowOverride All" privileges have been set (by you, by your ISP, or by a system administrator) in httpd.conf.

If this is feasible, or if you want to try the solution on your own, create or edit a file named .htaccess in YACS installation directory with following directives (assuming you want a 6Mb max attachment size):

php_value post_max_size "7M"
php_value upload_max_filesize "6M"
php_value max_input_time "120"


Note that you can not change the file_uploads setting in an .htaccess file.

[title]Uploads files separately[/title] If you ISP allows for uploads through WebDAV or FTP, you may reference these files from within YACS.

This is only a workaround, since you will have to upload files, then to use YACS to create related entries in the database.

Despite the tedious sounding, this works very well. For example, this is used at this site to provide the most recent release to visitors.

When a new YACS release is available, the archive is pushed to some FTP space by hand. Then, from within YACS the entire URL of this file, and its size are reported in a file entry.

Of course this solution requires an FTP account to work.

[title]Ask for support[/title] If you do not have access to php.ini, and if the .htaccess does not work, contact your hosting provider. Or change to another one...