First off, I know similar questions have been asked, however mine doesn't appear to be a server-limited file size....
When using one page with the form below and attempting to send to another file containing the script, it works fine with small files (under 2MB). However, a slightly larger file (around 3MB) it appears to pass the $_POST variables correctly, but the script fails for some unknown reason. Finally, a test file of 9MB fails to send the $_POST variables at all and a print_r($_POST)
shows each as undefined.
Here's the form:
<form enctype="multipart/form-data" id="formEditTAPPS" method="POST" action="scripts/editTAPPSprocess.php">
Page ID Number: <? echo $id; ?>
<input type="hidden" name="id" value="<? echo $id; ?>" />
<br />
Page Title: <input type="text" name="newPageTitle" value="<?php echo $row['title']; ?>" style="width:300px;" />
<br />
Number of Pages in PDF: <input type="text" name="newNumberOfPages" value="<?php echo $row['num_pages']; ?>" style="width:30px;" />
<br />
TAPPS Category:
<select name="newCategory">
<? while ($row2 = mysql_fetch_array($data2)) {
$catIDfromCat = $row2['cat_id'];
$catName = $row2['cat_name'];
?><option value="<? echo $catIDfromCat; ?>" <?php if ($catIDfromPages==$catIDfromCat){echo "selected=\"selected\"";} ?> ><? echo $catName; ?></option>
<? } ?>
</select>
<br />
Last Updated: <? echo $row['last_updated']; ?>
<br />
Display Order: <input type="text" name="newDisplayOrder" value="<?php echo $row['display_order']; ?>" />
<br />
Existing PDF: <a href="/files/tapps/<? echo $row['filename']; ?>" /><? echo $row['filename']; ?></a>
<br />
Upload a New PDF: <input name="newPDF" type="file" />
<br />
<input type="submit" name="Submit" value="Update this TAPPS Page" style="margin: 20px 0 0 50px;" />
And here's the processing script:
include_once('../../../common/db/conn.php'); // Connect to the database
// Assigns the variables passed from the form.
$id = $_POST['id'];
$title = $_POST['newPageTitle'];
$num_pages = $_POST['newNumberOfPages'];
$cat_id = $_POST['newCategory'];
$display_order = $_POST['newDisplayOrder'];
$newPDF = basename($_FILES['newPDF']['name']);
// Try to upload the file...
$target = "../../../files/tapps/";
$target = $target . $newPDF;
if(move_uploaded_file($_FILES['newPDF']['tmp_name'], $target)) {
// Saves the data into the correct database table.
$sql = "UPDATE tapps_pages SET title='$title', num_pages='$num_pages', cat_id='$cat_id', display_order='$display_order', filename='$newPDF' WHERE id='$id'";
// Verifies the database stores the form results and sends the user to the "Success" page.
$result = mysql_query($sql);
if($result) {
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=../editTAPPSpage.php?id=$id&success=1\">";
} else {
echo "<br /><br />Bummer, something broke. =(<br /><br />";
print_r($_POST);
}
} else {
// Problem uploading the file
echo "<br /><br />Looks like there was a problem uploading the TAPPS page... Better tell Kevin!<br /><br />He's going to want to know this info, so please copy and paste it into the email...<br />";
print_r($_POST);
echo "<br /><br />";
print_r($_SERVER);
echo "<br /><br />";
print_r($_SESSION);
}
Sounds like a upload_max_filesize
problem to me, but I've addressed that with a php.ini file:
memory_limit = 128M
max_execution_time = 600
upload_max_filesize = 50M
post_max_size = 64M
And phpinfo()
shows that the change stuck, after a reboot of Apache.
Am I missing a setting that could cause a timeout or limit the file size to 2MB? Thanks in advance for any help!