Page 1 of 1

PHP File Size Problem

Posted: Mon Jun 15, 2009 4:56 am
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?

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:00 am
by miro_igov
70999905 bytes is more than 10M, also you should set this post_max_size = 100M

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:13 am
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..

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:17 am
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.

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:28 am
by miro_igov
Check your upload script and make sure error display & reporting is enabled.

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:31 am
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.";
}
?>

Re: PHP File Size Problem

Posted: Mon Jun 15, 2009 5:34 am
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.";
        }
    }
 
?>