ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/apis/files-api.php

<?php
session_start();
include"../config/config.php";
if(isset($_POST['type']) && $_POST['type']=='files_add'){
        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 = 'upload/no-employee-image.gif';
                }
               
            $statement = $pdo->prepare("INSERT INTO `tbl_files_details`
            (`name`, `category`, `main_heading`, `sub_heading`, `order_no`, 
            `file_size`, `document`, `url`, `document_type`, `created_by`,`status`) VALUES (?,?,?,?,?,?,?,?,?,?,?)");
           
         
            $result = $statement->execute(array($_POST['file_name'],$_POST['category'],$_POST['headings'],0,$_POST['order_no'],
            $_POST['file_size'],$upload_image,$_POST['files_url'],$_POST['type'],$_SESSION['steel_plant']['id'],$_POST['status']));
               
                    if($result){
                     
                        $return_arr['message'] = 'File 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