Friday, June 3, 2011

Tip 6: Modifying Maximum Upload File Size in the File Gallery



By default, the maximum uploaded file size on Tiki depends on the initial setting of the php.ini file on the server. With this uploaded file size setting of the php.ini, we can set the maximum number of bytes of files to be uploaded. This does not impair an issue if we have set up our own server so that we can set a maximum number of file size that is uploaded. Problems will arise if we rent a server at a webhosting, which setting maximum size of file to be uploaded depends on the webhosting which we rent.

The following tips will help you in setting the maximum size of uploaded files that exist on the tiki.
  1. Open file /lib/filegals/max_upload_size.php, then search the following script:
    @$max_upload_size = $tikilib->return_bytes(ini_get('upload_max_filesize'));
  2. Suppose that the maximum uploaded file size is 200kb (kilobytes), then change the above script into:
    @$max_upload_size = 200 * 1024;       //(1 kb = 1024 bytes)
    Please be noticed that maximum size of the uploaded files should be less than the initial setting of maximum file size to be uploaded setting in the php.ini.
  3. Save and close / lib/filegals/max_upload_size.ph
  4. Open file file /tiki-upload_file.php. 
  5. Insert the following scripts, right before the script // Check the name:
    //Check file size, begin 
    if ($_FILES["userfile"]['size'][$key] > $max_upload_size) {
        $errors[]= tra(' Warning: Your file size is too big:') . ' ' . $_FILES["userfile"]["name"][$key] . '. ' . tra(' Try to compress the uploaded file under the maximum file size allowed (See: Maximum file size is around, below).');
        continue; 

    //Check file size, end
  6. Save and close /tiki-upload_file.php. Finish, now you can upload a file with your custom size.

No comments:

Post a Comment