<?php
  
    $file_path = "../../uploads/assignment/";
     
    $file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }


//this is our upload folder
//$upload_path = '../../uploads/assignment/';

//Getting the server ip
//$server_ip = gethostbyname(gethostname());

//creating the upload url
//$upload_url = 'http://'.$server_ip.'/AndroidPdfUpload/'.$upload_path;

//response array

/*$response = array();


if($_SERVER['REQUEST_METHOD']=='POST'){

    //checking the required parameters from the request
    if(isset($_POST['name']) and isset($_FILES['pdf']['name'])){

        //connecting to the database
        //$con = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME) or die('Unable to Connect...');

        //getting name from the request
        $name = $_POST['name'];

        //getting file info from the request
        $fileinfo = pathinfo($_FILES['pdf']['name']);

        //getting the file extension
        $extension = $fileinfo['extension'];

        //file url to store in the database
        //$file_url = $upload_url . getFileName() . '.' . $extension;

        //file path to upload in the server
        $file_path = $upload_path . "XXXCXC.txt" . '.'. $extension;

        //trying to save the file in the directory
        try{
            //saving the file
            move_uploaded_file($_FILES['pdf']['tmp_name'],$file_path);
        }catch(Exception $e){
            $response['error']=true;
            $response['message']=$e->getMessage();
        }
    }else{
        $response['error']=true;
        $response['message']='Please choose a file';
    }

    //displaying the response
    echo json_encode($response);
}*/



 ?>

