aradhya Posted October 15, 2010 Share Posted October 15, 2010 ok, so here is the problem....whenever i try to upload a file that is larger than say 700-800kb , the file doesnt upload...i checked my php.ini file n upload size is set to 20Mb...can anybody tell me the problem...here is my script if(!chkfilexists()) { $filename=$_FILES['file']['name']; $filetype=$_FILES['file']['type']; $filesize=$_FILES['file']['size']; echo"<script type='text/javascript'>alert($filesize)</script>"; $filetemp=$_FILES['file']['tmp_name']; $fsub=$_POST["file_sub"]; $filecat=$_POST['file_category']; if($_POST['exist_group']==null) { $fgroup=$_POST["new_group"]; } else { $fgroup=$_POST["exist_group"]; } $fp=fopen($filetemp,'rb'); $user_id=$_SESSION['username']; $content=fread($fp,filesize("$filetemp")); $encoded = chunk_split(base64_encode($content)); fclose($fp);$fquery="INSERT INTO assign_files(user_id,file_name,file_type,file_size,file_content,file_group,file_subject,file_category)VALUES('$user_id','$filename','$filetype','$filesize','$encoded','$fgroup','$fsub','$filecat')";mysql_query($fquery); Link to comment Share on other sites More sharing options...
justsomeguy Posted October 15, 2010 Share Posted October 15, 2010 You're not checking for errors with the upload, it could be anything. Check here:http://www.php.net/manual/en/features.file-upload.phpYou may also want to look over the tutorial:http://www.w3schools.com/php/php_file_upload.asp Link to comment Share on other sites More sharing options...
aradhya Posted October 15, 2010 Author Share Posted October 15, 2010 i edited my above code n addedmysql_query($fquery) or die(mysql_error());this is the error that i am getting-checking:Mysql server has gone away Link to comment Share on other sites More sharing options...
aradhya Posted October 15, 2010 Author Share Posted October 15, 2010 Ok, so i checked my servers max_allowed_packet is set to 1 Mb....so there is the problem in the server that i am using... Link to comment Share on other sites More sharing options...
thescientist Posted October 15, 2010 Share Posted October 15, 2010 edit: wrong thread Link to comment Share on other sites More sharing options...
aradhya Posted October 16, 2010 Author Share Posted October 16, 2010 yeah, sorry about that. I initially thought that something was wrong with my php script.. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.