SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: 2MB limit on uploads

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    london
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    2MB limit on uploads

    Hi there, I have created a simple upload form on a pretty vanilla LAMP installation running on a fedora 16 VM. I have set "file_uploads" to "on" and "upload_max_filesize" to "200M" from its original "2M" setting (my phpinfo() confirms this)


    however, whenever I try to upload anything over 2M, it uploads a blank file with the correct name. under 2M works like a dream ...are there any other settings i should be setting anywhere to get this to work ?

    my simple scripts is


    Code:
    <?php
    error_reporting(E_ALL);
    ini_set("display_errors", 1);
    
    $thisfile = $_SERVER['PHP_SELF'];
    
    $message = '
    <form enctype="multipart/form-data" method="post" action="'.$thisfile.'">
    <input type="file" name="file" />
    <br />
    <input type="submit" name="submit" value="submit" />
    ';
    
    if (!isset($_POST['submit'])) {
        echo $message;
    } elseif ($_POST['submit'] == 'submit') {
        $uploaddir = '/var/www/html/uploads/';
        $uploadfile = $uploaddir . basename($_FILES['file']['name']);
        if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
            echo "File move worked";
        } else {
            echo "File Move hasnt worked";
        }
    } else {
        $message = 'Damn it';
        echo $message;
    }
    ?>

    Like I say, the script works fine, just something is stopping it from uploading greater than 2M

    any help our guidance would be greatly appreicated

    Gary

  2. #2
    Hosting Advisor silver trophybronze trophy
    SitePoint Award Recipient cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    2,794
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Did you restart the apache server?

  3. #3
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    3,648
    Mentioned
    21 Post(s)
    Tagged
    1 Thread(s)
    It's a file size limitation set in your php.ini file.

    Are you working on a hosting provider's server, or your own server?
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  4. #4
    Hosting Advisor silver trophybronze trophy
    SitePoint Award Recipient cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    2,794
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Force Flow View Post
    It's a file size limitation set in your php.ini file.

    Are you working on a hosting provider's server, or your own server?
    From the Original Poster:
    Hi there, I have created a simple upload form on a pretty vanilla LAMP installation running on a fedora 16 VM. I have set "file_uploads" to "on" and "upload_max_filesize" to "200M" from its original "2M" setting (my phpinfo() confirms this)

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2004
    Location
    london
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    interestingly, i have discovered that I can transfer to the php.ini limit from internally (on same network) but when coming in from anywhere in the internet its 2M only ....could this be an apache setting as opposed to being a php one?

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Location
    Brisbane Australia
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You may need to change the post data size in the php.ini file as well it needs to be greater than the 200M set for max allowed file size e.g 210M. Cheers

  7. #7
    SitePoint Member saokimbranding's Avatar
    Join Date
    Nov 2011
    Location
    Vietnamese
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why you don't enable display errors & log errors? Paste it on this topic

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
  •