ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Uploaded File exceeds the maximum allowed size

June 25, 2008 8:31am

Subscribe [4]
  • #1 / Jun 25, 2008 8:31am

    Zeeshan Rasool

    261 posts

    Hi, plz help me in this case,

    An error is there!

    Error:The uploaded file exceeds the maximum allowed size in your PHP configuration file

    My code is:

    $config[’upload_path’] = ‘./resources/admin_videos’;
    $config[’allowed_types’] = ‘mp3’;
    $config[’max_size’] = ‘500000’;
    $config[’overwrite’] = false;

    $this->upload->initialize($config);
    $this->load->library(’upload’, $config);
    if(!$this->upload->do_upload($video))
    {
    $error = array(’error’ => $this->upload->display_errors());
    return $error;
    }
    else
    {
    $data = array(’upload_data’ => $this->upload->data());
    $video_path =$data[’upload_data’][’file_name’];

    }
    ////////// also included
    ‘mp3’ => array(’audio/mpeg’, ‘audio/mpg’)but no result.

    Any guy who know the solu.
    ....................JamZee

  • #2 / Jun 25, 2008 12:06pm

    mironcho

    119 posts

    Hi JamZee,
    The problem is in your php configuration, not in CI’s upload config. Simply change upload_max_filesize in your php.ini, e.g.:

    upload_max_filesize = 10M
  • #3 / Jun 25, 2008 12:26pm

    Chris Newton

    440 posts

    You may have a problem changing the upload max size on a shared host. Some give you easy access to the php.ini or allow you to override it with an .htaccess file, but it just depends on the server.

  • #4 / Jun 26, 2008 1:23am

    Zeeshan Rasool

    261 posts

    thnx Guys, i have change my php.ini from server but in phpinfo it shows yet 2M , Why?
    prob. is still on
    ;;;;;;;;;;;;;;;;
    ; File Uploads ;
    ;;;;;;;;;;;;;;;;
    ; Whether to allow HTTP file uploads.
    file_uploads = On
    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ;upload_tmp_dir =
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 20M
    ;;;;;;;;;;;;;;;;;;

  • #5 / Jun 26, 2008 2:38am

    Zeeshan Rasool

    261 posts

    ok i get it..
    After inc. size in php.ini fle. Restart the system makes it posible now i can upload upto 50 M
    thnx guys…....

  • #6 / Jun 26, 2008 9:41am

    Xperia

    5 posts

    You can also use

    ini_set('upload_max_filesize','20M');

    in your script, useful if one doesn’t have access to edit php.ini

  • #7 / Jun 26, 2008 10:07pm

    Seppo

    483 posts

    You can also use

    ini_set('upload_max_filesize','20M');
    in your script, useful if one doesn’t have access to edit php.ini

    You really can’t do that… take a look here, upload_max_filesize is changeable PHP_INI_PERDIR, so you can change it on your php.ini or using .htaccess, the best solution if you can’t modify your php.ini.

    You can not use it on the run because the upload itself happens before the php file execution

  • #8 / Oct 08, 2008 5:35pm

    jdgiotta

    12 posts

    I’m having a problem with filesize exceeding the limit, but its not throwing an error to the upload library.
    Instead my apache error log tells what happened and the web served result is a completely blank screen.

    Please advice.

  • #9 / Oct 08, 2008 7:22pm

    Chris Newton

    440 posts

    I’d suggest using the following to handle large uploads rather than changing the PHP settings.

    http://don.citarella.net/index.php/actionscript-examples/flash-file-uploader/

    It gives feedback (unlike standard PHP) and lets you get around the max_filesize thing pretty easily.

  • #10 / Nov 13, 2008 1:11pm

    SitesByJoe

    163 posts

    Where would you put the .htaccess file?  Would you use the same .htaccess file that removes the index.php etc?

  • #11 / Nov 13, 2008 1:39pm

    Chris Newton

    440 posts

    In the past I’ve put some PHP.ini overrides in the root .htaccess and they’ve worked fine. Basically wherever your script is running from (in this case the index.php file) at that level or above, up to the root level.

  • #12 / Nov 14, 2008 1:55am

    Adam :: Envise

    8 posts

    Where would you put the .htaccess file?

    Most likely in the root directory of CI.

    Would you use the same .htaccess file that removes the index.php etc?

    Yes, thats probably the best spot.

  • #13 / Aug 07, 2013 7:51pm

    Sunnyland

    66 posts

    You may have a problem changing the upload max size on a shared host. Some give you easy access to the php.ini or allow you to override it with an .htaccess file, but it just depends on the server.

    What would the syntax be to post this script in the .htaccess file?

    I ask because popping

    upload_max_filesize = 10M

    into the .htaccess file instantly causes the whole site to crap out with a 500 internal server error.

    Cheers.

  • #14 / Aug 08, 2013 12:03pm

    Chris Newton

    440 posts

    In an HTACESS file:

    php_value post_max_size 30M
    php_value upload_max_filesize 30M

    The server may still throw an error. Some servers don’t allow changing PHP values in the HTACESS file.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases