file upload problem file to large

file upload problem file to large

Posted by: Griffo
Posted on: 2009-10-29 01:32:00

Hi, i have added a file upload section to a admin only part of a website.

I have also updated the php.ini file for multiple domains(http://wiki.dreamhost.com/PHP.ini), yet i still have problems.

I am trying to upload audio(mp3) no larger than 10M.

Has any one had similar trouble.

Thanks

Griffo



Re: file upload problem file to large

Posted by: sXi
Posted on: 2009-10-29 02:56:00

You'll need to check 2 settings in your php.ini:

  post_max_size = 11M
upload_max_filesize = 10M




How To Install PHP.INI / ionCube on DreamHost

Re: file upload problem file to large

Posted by: Griffo
Posted on: 2009-10-29 03:21:00

yes i have checked those values,

and i did change them initially.

I even restarted phpcgi

and recached php-wrapper.fcgi.

But when i attempt to run my upload script it returns an error of 1 for the php FILES array, which means the php file limit is set lower than file.

im using a mp3 file.

At this stage things are pointing to my php script so ill add it in here.
<?php

include "dbconn.php";
//include "php.ini";

$title = $_POST['title'];
$url = $_POST['url'];
$file = $_POST['file'];

//insert print data into db

$connection = connectDB();
$insert = " INSERT INTO audio ".
" VALUES (null, \"$title\", \"$url\", null)";
$result2 = mysql_query($insert,$connection);
disconnectDB($connection);

if (move_uploaded_file ($_FILES['file'] ['tmp_name'],
"audio/{$_FILES['file'] ['name']}") ) {
echo 'all good!';
}
else
{


switch ($_FILES['file'] ['error'])
{ case 1:
print '<p> The file is bigger than this PHP installation allows</p>';
break;
case 2:
print '<p> The file is bigger than this form allows</p>';
break;
case 3:
print '<p> Only part of the file was uploaded</p>';
break;
case 4:
print '<p> No file was uploaded</p>';
break;
}
}
?>