25 lines
625 B
PHP
25 lines
625 B
PHP
|
|
<?php
|
||
|
|
class FileHandler{
|
||
|
|
public $target_dir='upload/';
|
||
|
|
public $input_name='fileToUpload';
|
||
|
|
public $target_file;
|
||
|
|
public $orginal_file;
|
||
|
|
public $file_id;
|
||
|
|
public $file_date;
|
||
|
|
|
||
|
|
public function __construct(){
|
||
|
|
$this->file_id=create_guid();
|
||
|
|
$this->target_file=$this->target_dir.basename($this->file_id.'.xls');
|
||
|
|
$this->orginal_file=$_FILES[$this->input_name]["name"];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function uploadFile(){
|
||
|
|
if (move_uploaded_file($_FILES[$this->input_name]["tmp_name"], $this->target_file)) {
|
||
|
|
$this->file_date= date ("Y-m-d H:i:s", filemtime($this->target_file));
|
||
|
|
return true;
|
||
|
|
} else {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
?>
|