PHP File Size Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eatspinach
Forum Newbie
Posts: 20
Joined: Mon Apr 20, 2009 8:50 am

PHP File Size Problem

Post by eatspinach »

Hi

I made a simple file upload form, and it works fine for small files (349bytes) but i need this form to work for uploading larger file sizes.. such as 5mb.
When i try uploading one of these file i get the following error,

Warning: POST Content-Length of 70999905 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

I added this line to the php.ini

upload_max_filesize = 10M ;

which didnt seem to do anything?
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Re: PHP File Size Problem

Post by miro_igov »

70999905 bytes is more than 10M, also you should set this post_max_size = 100M
eatspinach
Forum Newbie
Posts: 20
Joined: Mon Apr 20, 2009 8:50 am

Re: PHP File Size Problem

Post by eatspinach »

woops, silly me..

i popped in

upload_max_filesize 100M
post_max_size 100M

into the php.ini and now when i try to upload an mp3 of 6mb i am getting no errors or warnings, but the file doesnt appear in the upload folder??

if i upload a small gif image that appears in the upload folder..
eatspinach
Forum Newbie
Posts: 20
Joined: Mon Apr 20, 2009 8:50 am

Re: PHP File Size Problem

Post by eatspinach »

also i just up uploaded an mp3 of file size 100 KB and that worked fine, so its not a file type problem.
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Re: PHP File Size Problem

Post by miro_igov »

Check your upload script and make sure error display & reporting is enabled.
eatspinach
Forum Newbie
Posts: 20
Joined: Mon Apr 20, 2009 8:50 am

Re: PHP File Size Problem

Post by eatspinach »

hmm not sure what i should be looking for, sorry i'm a complete newb to php, here is my upload script..

Code: Select all

<?php
$target = "upload/";
$target = $target . basename( $_FILES['uploaded']['name']) ;
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}
?>
eatspinach
Forum Newbie
Posts: 20
Joined: Mon Apr 20, 2009 8:50 am

Re: PHP File Size Problem

Post by eatspinach »

wait that's the old code, its actually this code,

Code: Select all

<?php
if (array_key_exists('_submit_check', $_POST)) {
        
        $quesAudio1 = "test";
        $target = "upload/";
        $target = $target . basename( $_FILES['uploaded']['name']) ;
        $ok=1;
        if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
        {
            //echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
            
            //build the query string
            $query = "UPDATE questions SET audioLocation= '$target' WHERE surveyId = $surveyId";
            
            //debug
            //echo $query;
            
            //insert the query
            insertMySQL($query);
        }
        else {
        //echo "Sorry, there was a problem uploading your file.";
        }
    }
 
?>
Post Reply