SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to upload a file of more than 5 mb in size

    Hi,
    I got a problem, whenever i try to upload a file of more than 5 MB, the post fields (we are using method="POST" in the form) are not available to the page. Can anybody help why this problem is arising.
    It works fine for 2-3 MB of files.
    Thanks.

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Rule No 1: search the forum before posting a thread.

    You have to increase post_max_size and upload_max_filesize. You can use ini_set for such thing.

    Check it out at http://yu.php.net/manual/en/ini.php#ini.list
    -- Jelena --

  3. #3
    SitePoint Enthusiast rev909's Avatar
    Join Date
    Mar 2002
    Location
    Romania
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Display phpinfo in a script on your server like this:

    PHP Code:
    <?php
    phpinfo
    ();
    ?>
    Then scroll down and search for upload_max_filesize. That's the limit set by your server and probably that's why big file uploads do not work.
    Science is magic that works!
    -- Kurt Vonnegut Jr.

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    see where your bottleneck is
    do a phpinfo() and check these:

    post_max_size
    upload_max_filesize
    memory_limit

    sounds like your problem is post_max_size, because when you exceed that value, your _POST variables will all go empty on you, like you said they are. you can only change that value in php.ini or httpd.conf, ini_set() wont work because the limit is reached before php begins parsing your script.

  5. #5
    SitePoint Enthusiast DoubleM's Avatar
    Join Date
    Mar 2006
    Location
    West -USA
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    upload_max_filesize by default is set to 2M

    Hi,

    If PHP is installed as an apache module, then generally there are three possible ways to modify the value of the PHP directives "e.g. upload_max_filesize":
    - through the script itself by using the function ini_set().
    -through the system configurations files "e.g. php.ini or httpd.conf".
    - or it can be modified through the per directory file configration ".htaccess".
    some directives work in every way but some are limited to one or two ways. Depending on what directive and on what you need you can choose the proper way. For more information on each directive and where it can be modified please read this reference page:


    php.ini directives

    All best,
    DoubleM
    <?php5 echo 'I am just a very newbie ! '; ?>

  6. #6
    SitePoint Member
    Join Date
    Feb 2006
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok thanks, It works now for files of 8MB size. I have to check for heavier file sizes. I dont want to impose ane restriction for file uploading.
    Is there any maximum size restriction that we can upload.
    Last edited by akashsharma; Mar 9, 2006 at 07:05.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •