i can't understand why my server isn't accepting files larger than 1MB. i am using cpanel and my host has told me that i can't edit my php.ini file directly. below is my upload code:
<?php
if (array_key_exists('uploadfile',$_POST)) {
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
mysql_query("INSERT INTO tbl_vehiclefiles (`veh_id`,`name`,`type`,`size`,`content`)
VALUES ('$veh_id', '$fileName', '$fileType', '$fileSize','$content')");
echo '<b>File Upload</b><p>Thank you. The file has been successfully uploaded.
<p><img src="resources/spacer.gif" alt="" width="300px" height="5px" /><p><o>
<i><u>Name:</u> ' . $fileName . '<p><i><u>Size:</u> ' . $fileSize . 'k' . '<p><u>Type:</u> ' . $fileType . '</i><p><p><img src="resources/spacer.gif" alt="" width="300px" height="5px" />';
$file_id = mysql_insert_id();
echo "</i><p><a href='managevehicle.php?id=$veh_id' class='form'>Manage details</a><p>
<a href='viewfile2.php?id=$file_id' class='form'>View details</a><p>";
exit;
}
?>
<b>File Upload</b></p>
<p>
<input type="hidden" name="MAX_FILE_SIZE" value="200000000">
<span id="sprytextfield1">
<input name="userfile" type="file" id="userfile">
</span><BR />
<input type="hidden" name="uploadfile" value="1"/>
<input name="upload" type="submit" id="upload" value=" Upload ">
</p>
i was told that i could create my own php.ini file and save it on cpanel file manager to override some of the php.ini values. this is what i have on it at the moments:
//Common local changes:
upload_max_filesize = 20M; // (default 8 - Max, 32)
post_max_size = 20M; // (Average, 20 - Max, 32)
register_globals = Off; // (off by default - you can turn On)
allow_url_fopen = On; // (off by default - you can turn to On)
memory_limit = 24M; // (default of 8M, Max 32)
but it has no effect! any suggestions? thanking you in advance!