Hi,
I've read plenty of discussions here and elsewhere about file upload scripts falling over when they reach a certain size (anywhere between 512k and 2mb) - I am having the same problem, but can't seem to resolve it. Files smaller than 2mb or so work without problem, anything larger does not even return an error, the request just times out.
post_max_size is set to 8M and upload_max_filesize is set to 10M (as reported by phpinfo) and I am not running squid (it is installed, and the conf file with offending variable exists, but commented out, and the cache is not running at all). The file is placed into /tmp so the code is obviously falling over after the upload, but as you can see with the snippet below, any probs with the file should at least return an error. ( I added the top trap just to test, it's not helping).
curiously, this code worked just fine until a recent upgrade of both apache and PHP to 4.3.0 and 1.3.27 (from a lower 1.3.2x and 4.1.x)
here's how it's handled:
if ($HTTP_POST_FILES['audfile']['error']) {
echo "$HTTP_POST_FILES['audfile']['error']";
} else {
if ($submitted=="yes") {
//was a file uploaded?
$mp3file = $HTTP_POST_FILES['audfile']['tmp_name'];
if (is_uploaded_file($mp3file))
{
//find out what it was
// Open the uploaded file
$file = fopen($mp3file, "rb");
// Read in the uploaded file
$fileContents = fread($file, filesize($mp3file));
// Escape special characters in the file
$fileContents = AddSlashes($fileContents);
if(!mysql_query("INSERT INTO mp3 (AudioID,TrackID,AudioFile) VALUES ('','$TrackID','$fileContents')"))
{
echo "MP3 addition failed. Please try again.<br>";
echo mysql_error();
include('mp3form.php');
} else {
echo "Added MP3! Click <a href='trackmanage.php'>here</a> to return to discography manager.<br>";
}
} else {
echo "no file uploaded!";
}
}