public function actionGetFile()
 {
     $model = new GetFile();
     $model->attributes = isset($_POST) ? $_POST : '';
     if ($model->validate()) {
         //validating json data according to action
         $model->readFile();
     } else {
         echo json_encode($model->getErrors());
     }
 }
<?php

define('DS', DIRECTORY_SEPARATOR);
//right directory separator in current file system
define('HOME', dirname(__FILE__));
//location of home directory = this is where write.php file is
//
//  include 2 files with required classes
//
require HOME . DS . "Classes" . DS . "GetFile.class.php";
require HOME . DS . "Classes" . DS . "ReadFile.class.php";
if (isset($argv[1]) && $argc == 2) {
    //
    //      object of GetFile class
    //
    $file = new GetFile($argv[1]);
    //check filetype of output file
    $file->checkFileType();
    //
    //      object of ReadFile class
    //
    $read = new ReadFile($argv[1]);
    //read file and write content on the screen
    $read->read();
} else {
    if ($argc > 2) {
        //if user enter 2 or more arguments
        die("Too much arguments!");
    } else {
        //if user not enter any arguments
        die("You don't enter file!");
Esempio n. 3
0
 public static function get()
 {
     return GetFile::make();
 }