#1
  1. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13

    Question is there a limit to post_max_size?


    1.) Is there a limit on post_max_size?
    2.) How about upload_max_filesize?
    3.) The manual mentioned something about memory_limit has to be bigger then post_max_size. I can't seem to find "memory_limit" in my phpinfo.php page. Am I blind?
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard
  2. #2
  3. No Profile Picture
    Always Learning
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Oct 2002
    Location
    Port Neches, TX, USA
    Posts
    1,173
    Rep Power
    16
    your max upload size is set in php.ini, and it has to be smaller than the amount of ram your computer has available; that's typically no more than 50% of your total ram. why would you want to upload such mammoth files through php?
    David Fells
    If my post helped you, please click the above my post and leave a comment. Thanks
  4. #3
  5. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13
    I was just curious.

    Is there a way to error trap for post_max_size? Say a user uplaods 11 MB and my post_max_szie is set to 8MB. Right now all I get is a Can not find page error.
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Posts
    645
    Rep Power
    0
    usually it is set in the form as max_file_size as a hidden input. that way you can check when the file gets uploaded.

    by default php is set to 2M.

    all you have to do is check the max_file_size against the filesize

    something like this

    $filesize=filesize($_FILES['fileupload']['name']);
    if ($max_file_size!=0 and $filesize>$max_file_size) {
    display to big message here.
    }
  8. #5
  9. Charge into the Knight
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2002
    Location
    Orlando, FL
    Posts
    276
    Rep Power
    13
    Thanks
    Every man is a fool for at least five minutes every day; wisdom consists of not exceeding the limit.-- Elbert Hubbard
  10. #6
  11. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    328
    Rep Power
    14
    It's easy to change in php.ini. However, most people can't edit their php.ini (because their site is hosted and the hosting company won't allow it).

    An easy way to get arround this if the following .htaccess file:
    php_value post_max_size 1000M
    php_value upload_max_filesize 1000M

    Maybe this is a little bit off topic and obsolete for most of you PHP guru's, but I want to inform all other newbies (like me).

    Good luck, Filip
  12. #7
  13. Web Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2001
    Location
    Finland
    Posts
    719
    Rep Power
    15
    Originally posted by bizzk
    IAn easy way to get arround this if the following .htaccess file:
    php_value post_max_size 1000M
    php_value upload_max_filesize 1000M
    Well, now that we're on the topic, could you tell me why this doesn't work for me? I use, the almost exact same, except they are in my virtual host, like so:

    Code:
    <VirtualHost 127.0.0.1>
      ServerName www.okartek.lin
      ServerAdmin webmaster@datamike.org
      DocumentRoot "/var/www/html/okartek/pankki"
      Alias /images "/var/www/html/okartek/images"
      Errorlog /var/www/html/okartek/logs/error_log
    
      php_value upload_tmp_dir /var/www/html/okartek/filebank
      php_value post_max_size 500M
      php_value upload_max_filesize 500M
    </VirtualHost>
    When i check my phpinfo page, it only uses one of the php_value directives, namely the upload_max_filesize and sets it neatly to 500M. But both upload_tmp_dir and post_max_size directives are not uploaded. Apache is restarted normally, without any hint in start up or in the logs.

    If I use these same values in php.ini everything is fine, but in the Virtual Host, they don't work. I'm a little lost. Any ideas?
    -- Tomi Kaistila
    -- Developer's Journal

    The more you learn, the more you know.
    The more you know, the more you forget.
    The more you forget, the less you know.

IMN logo majestic logo threadwatch logo seochat tools logo