<?php
include_once(_DIR_EXT.'/HTML/c_page_TXT.php') ;
include_once(_DIR_TO_ENGINE.'/admin/i_admin_system.php') ;
class c_page_cab_esmo_magnit_instruction_upload_json extends c_page_TXT
{ public $terminal_id ;
  public $personal_id ;
  public $mo_id ;

  function c_page_json() {}
  function body()
  { $res=array() ; ob_start() ;
    if (_sizeof($_FILES)) $res=$this->upload_doc() ;
    $res['report']=ob_get_clean() ;
    $text_json_out=json_encode($res,JSON_UNESCAPED_UNICODE) ;
    echo $text_json_out ;
  }

  function upload_doc()
  {   $result=array() ;
      if (_sizeof($_FILES))
       { foreach($_FILES as $file_info) obj_upload_file($_POST['theme_reffer'],$file_info,array('view_upload'=>1,'new_obj_rec'=>array('obj_name'=>$file_info['name'],'account_id'=>MEMBER()->id)))   ;
         $result['status']='ok'  ;
       }
       else $result['status']='error'  ;
       return($result) ;
    }



}
