GIF89a php
Current File : /home/drbalajibabycent/public_html/Admin-Panel/employee18.php
<?php
// Include the database configuration file
include 'db.php';
$statusMsg = '';

// File upload path
$targetDir = "image/Slider/";
$fileName = basename($_FILES["file"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(isset($_POST["submit"])&& !empty($_FILES["file"]["name"])){
    // Allow certain file formats

   $id=$_POST['id'];
    //$titlename=$_POST['name'];
     //$pag=$_POST['pag'];
    

   
    
    
    

    

    

    $allowTypes = array('jpg','JPG','png','PNG','jpeg','JPEG','gif','pdf','docx','doc');
    if(in_array($fileType, $allowTypes)){
        // Upload file to server
        if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)){
            // Insert image file name into database
            $insert = $db->query("update p18 set file='$fileName' where id='$id'");
            if($insert){
                $redirectUrl = 'Slider_view.php';

    echo '<script type="application/javascript">alert("Registered"); window.location.href = "'.$redirectUrl.'";</script>';

            }else{
                $statusMsg = "File upload failed, please try again.";
            } 
       
}
}
}


// Display status message


echo $statusMsg;

?>