I am building a file sharing application in PHP so that users can upload pretty large pdf files (up to 15 M to a web server. It all works as it should for files up to 8MB. Anything over 8 MB, however, doesn't go up at all. In Firefox, it gives a "The document contains no data." alert a few seconds after the form is submitted. In IE, after a few seconds it goes to the address of the page that is supposed to process the file, but displays the "The page cannot be displayed" page.
Any ideas as to what might be keeping the files over 8MB from being uploaded?
I've added the standard MAX_FILE_SIZE hidden form element on the form submission page:
<input type="hidden" name="MAX_FILE_SIZE" value="16384000">
Here's the file process statement:
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0) {
$file_name = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$file_size = $_FILES['userfile']['size'];
$file_type = $_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); }
// From here I insert the file information into one DB table and the actual file into another DB table, linked to the first with a key.
... }
I've optimized my php.ini and mysql.ini settings for larger files...though I'm not sure if I haven't overlooked something here. I've never had to mess with these settings in the past. The problem arises before I attempt to insert the file into the DB, so I'm guessing the problem lies on the PHP configuration side rather than the mysql configuration size, but I'm not sure.