File indexing completed on 2024-12-22 05:33:23

0001 <?php
0002 
0003 include("gfx3/lib.php");
0004 
0005 $prevpage = EPageProperties::get_previous_page();
0006 
0007 $idcontent = EHeaderDataParser::db_post("idcontent");
0008 
0009 if(!empty($_FILES['localfile'])){
0010   
0011   $tmp_name = $_FILES['localfile']['tmp_name'];
0012   $name = $_FILES['localfile']['name'];
0013     
0014   $client = new OCSClient();
0015   $client->set_auth_info(EUser::nick(),EUser::password());
0016   $abs_name = EFileSystem::rename_file($tmp_name,"/tmp/".$name);
0017   $client->set_upload_file("/tmp/".$name);
0018   $result = $client->post("v1/content/uploaddownload/$idcontent");
0019   if($result["ocs"]["meta"]["statuscode"]=="100"){
0020     header("Location: $prevpage");
0021   } else {
0022         //echo $client->get_last_raw_result();
0023     ELog::error("something went wrong");
0024   }
0025   
0026 }
0027 
0028 ?>