ok

Mini Shell

Direktori : /proc/thread-self/root/home2/selectio/www/pvmatricschool.com/admin/api/
Upload File :
Current File : //proc/thread-self/root/home2/selectio/www/pvmatricschool.com/admin/api/video-add-api.php

<?php
session_start();
include"../config/config.php";
if(isset($_POST['type']) && $_POST['type']=='add_video'){
        try{
            $date = date('Y-m-d h:i:s', time());
            
             if(isset($_FILES['photo']) && $_FILES["photo"]["name"]!=""){
                        $extension = end(explode(".", $_FILES["photo"]["name"]));
                        $image = rand(10,1000000000)."-image." . $extension;
                        $upload = move_uploaded_file($_FILES['photo']['tmp_name'], '../upload/' . $image);
                        $upload_image = 'upload/' . $image;   
                }
                else{
                    $upload_image='';
                }
                
                
                if(isset($_FILES['video']) && $_FILES["video"]["name"]!=""){
                        $extension1 = end(explode(".", $_FILES["video"]["name"]));
                        $image1 = rand(10,1000000000)."-video." . $extension1;
                        $upload1 = move_uploaded_file($_FILES['video']['tmp_name'], '../upload/' . $image1);
                        $upload_image1 = 'upload/' . $image1;   
                }
                else{
                    $upload_image1='';
                }
               
            $statement = $pdo->prepare("INSERT INTO `tbl_videos`(`tittle`, `videos`, `image`) VALUES (?,?,?)");
            $result=$statement->execute(array($_POST['video_heading'],$upload_image1,$upload_image));
               
                    if($result){
                     
                        $return_arr['message'] = 'Video Added successfully!';
                        $return_arr['status']=200;
                          
                    }else{
                        $return_arr['message']="Something went wrong try again...";
                        $return_arr['status']=400;
                    }  
                }catch(Exception $e){
                    $return_arr['message']='0987'.$e;
                    $return_arr['status']=500;
                }   
                echo json_encode($return_arr);
    }

?>

Zerion Mini Shell 1.0