file uploads >800K with php into a BLOB field

From: Date: Mon, 30 Dec 2002 21:22:30 +0000
Subject: file uploads >800K with php into a BLOB field
Groups: php.general 
Request: Send a blank email to php-general+get-129715@lists.php.net to get a copy of this message
i'm having trouble with using php to upload files to be used as resources over the web via php and a backend db. i don't prefer to store them on the filesystem, but i guess thats an ultimate solution. either way, my code works, in theory, and literally. but not on file above 799KB. why? got me. I removed the php upload limit to 2GB. how about mysql? or maybe internet explorer is the one having trouble. seems IE is getting impatient with files over 2MB, it never comes back to the page it POSTs to, just gives that generic error screen. my code follows... set_time_limit(20*60); $filehandle = fopen( $_FILES['thefile']['tmp_name'], "rb"); $filedata = fread($filehandle, filesize($_FILES['thefile']['tmp_name'])); $filedata = addslashes($filedata); $name = $_FILES['thefile']['name']; $size = filesize($_FILES['thefile']['tmp_name']); $mime = $_FILES['thefile']['type']; $desc = $_POST['desc']; print "Uploaded: $name<br>File Size: $size<br>"; $query = "INSERT INTO resources (name,mime,size,desc,file) values ('$name','$mime','$size','$desc','$filedata');"; if(!$result = mysql_query($query)) { print '<font color="red">Query to database failed.<br>'; $myerr=mysql_error(); print "$myerr </font><br>"; } -- Mike Brancato

« previous php.general (#129715) next »