| Current Path : /home/bolconlineco/www/admin/ |
| Current File : //home/bolconlineco/www/admin/coursecode.php |
<?php
ob_start();
include('../includes/connection/func.inc.php');
$material_name = sql_strip($_POST['material_name']);
$name = $_FILES['materials']['name'];
$temp_name = $_FILES['materials']['tmp_name'];
$course_id=$_POST['course_id'];
$allowed=array('doc','docx','pdf');
$type=explode('.',$name);
$dir="../combine/coursematerials/";
$rand=mt_rand();
$fullname=$rand.$name;
if(in_array($type[1],$allowed))
{
if(move_uploaded_file($temp_name,$dir.$fullname))
{
$sql="INSERT INTO coursematerials values('','$course_id','$material_name','$fullname')";
$result=mysql_query($sql) or die(mysql_error());
$msg="Course Materials Inserted Successfully";
header("location:course_pdf.php?msg=$msg");
exit();
}
}else
{ $msg="Enter Correct File to upload";
header("location:course_pdf.php?er=$msg");
exit();
}
?>