Page 1 of 1

HELP, PHP MySQL fail to Uploading file more then 1mb

Posted: Mon Mar 13, 2006 12:55 pm
by adisonz
HELP, PHP MySQL fail to Uploading file more then 1mb ,

Code: Select all

$sub_id = $_SESSION["subid"];
        $fileName = $_FILES['userfile']['name']; 
        $tmpName  = $_FILES['userfile']['tmp_name']; 
        $fileSize = $_FILES['userfile']['size']; 
        $fileType = $_FILES['userfile']['type']; 
        $desc = $_POST['desc'];
		
		
        $fp = fopen($tmpName, 'r'); 
        $content = fread($fp, $fileSize); 
        $content = addslashes($content); 
        fclose($fp); 
         
        if(!get_magic_quotes_gpc()) 
        { 
            $fileName = addslashes($fileName); 
        } 
  
        $query = "INSERT INTO course_upload (sub_id, description, name, size, type, content) VALUES ('$sub_id','$desc','$fileName', '$fileSize', '$fileType','$content')"; 

		
		
		  
        mysql_query($query) or die('Error, query failed'.mysql_error());

my php.ini max file size is alreayd set to 2mb,
it has no problem when uploading file below 1mb , when i select a file more then 1mb will return an error "MySQL server has gone away".
Please help . assignment due date is near.

Posted: Mon Mar 13, 2006 1:29 pm
by adisonz
i am using mysql 5.01
i had changed the my-medium.ini max_allow_packet to 10mb and saved into the data folder as my.cnf
but still not working.

please correct me what i had done wrongly .
thank you