ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/public_html/thedentalpark.com/admin/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/public_html/thedentalpark.com/admin/files-details-edit.php

<?php  include "header.php";

if(isset($_POST['update_event'])){
    
    
    try {
        
        
        $status = $_POST['status'];
        $ids = $_POST['ids'];
        $date = date('Y-m-d h:i:s');
        
        
        
          if(isset($_FILES['gallery_image']) && $_FILES["gallery_image"]["name"]!=""){
                    
                    // Process the uploaded file
                    $file_name = $_FILES['gallery_image']['name'];
                    $original_name = str_replace('-', ' ', $file_name);
                    $store_file_name = pathinfo($original_name, PATHINFO_FILENAME);
                    $target_dir = '../naac/upload/';
                    $target_file = $target_dir . basename($file_name);
                    
        
              // Upload the file
                unlink('../'.$_POST['old_photo']);
                $upload = move_uploaded_file($_FILES['gallery_image']['tmp_name'], $target_file);
                    
                    
                    $banner = 'naac/upload/' . $file_name;
                }
                else{
                    $store_file_name = $_POST['old_file_name'];
                    $banner=$_POST['old_photo'];
                }

           
            //Store the datas on database
            $statement = $pdo->prepare("UPDATE tbl_pdf SET file_name=?,file=?,status=?,updated_at=? WHERE id=?");
            $result=$statement->execute(array($store_file_name,$banner,$status,$date,$ids));
          
                if($result){
                     echo  '<script type="text/javascript">
                        alert("File updated Successfully");
                        window.location.href = "notes-file-list.php";
                        </script>';
                        unset($_POST);      
                    }else{
                      echo  '<script type="text/javascript">
                        alert("Something went wrong try again...");
                        </script>';
                    } 
 
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}


    
    
    
    
       
    }
    $ids=$_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_pdf WHERE id=".$ids);
    $statement->execute();
    $events_data = $statement->fetchAll(PDO::FETCH_ASSOC);
?>
<div class="content-wrapper" style="background:white;">
        <section class="content-header">
            <h4><b>Update Naac Image</b></h4>
            <ol class="breadcrumb">
                <li><a href="index.php"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Update Naac File</li></ol>
        </section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        
                        <form action="" enctype="multipart/form-data" method="post" accept-charset="utf-8">
                            <div class="row">
                            <input type="hidden" name="ids" id="ids"  value="<?=$ids?>"  >
                            
                            
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="file">Choose The PDF Files</label>                                    
                                    <input type="file" name="gallery_image"  id="photo" value="" accept="application/pdf"  class="form-control tip"/>
                                    
                                    <input type="hidden" name="old_file_name"  id="old_file_name" value="<?=$events_data[0]['file_name']?>" accept="application/pdf"  class="form-control tip" />
                                    
                                    <input type="hidden" name="old_photo"  id="old_photo" value="<?=$events_data[0]['file']?>" accept="application/pdf"  class="form-control tip" />
                                </div>
                                <span style="color: red;" id="photospan"></span>
                            </div>
                            
                            
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="status">Status</label>                                    
                                    <select name="status" id="status" class="form-control tip select2">
                                        
                                        <option value="1" <?php if($events_data[0]['status']==1){echo 'selected';}?>>Active</option>
                                        <option value="0" <?php if($events_data[0]['status']==0){echo 'selected';}?>>In-Active</option>
                                       
                                    </select>
                                </div>
                            </div>
                           
                            <div class="col-md-4">
                                <div class="form-group">
                                    <label class="required" for="file">Action</label><br>
                                    <input type="submit" id="add_category" name="update_event" value="Update"  class="btn btn-success" />
                                </div>
                            </div>
                        </div>
                        </form>                    
                    </div>
                </div>
                        <div class="form-group" style="text-align:center;">
                            <?php echo "<a href=files-details-edit.php?id=".$ids.">
                            <button class='btn btn-primary' >
                            <i class='fa fa-refresh'></i> Reset Form</button></a>"; ?> 
                                            
                             <a href="notes-file-list.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
                         </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>

<?php include "footer.php";?>

Zerion Mini Shell 1.0