· Nov 14, 2018

Upload File in server


Is there anyone who can convert this code From PHP TO CACHE in File (.mac)?

this is my function is empty :/ 
thank you all

$output_dir = "uploads/";
    $ret = array();
//    This is for custom errors;    
/*    $custom_error= array();
    $custom_error['jquery-upload-file-error']="File already exists";
    echo json_encode($custom_error);
    $error =$_FILES["myfile"]["error"];
    //You need to handle  both cases
    //If Any browser does not support serializing of multiple files using FormData() 
    if(!is_array($_FILES["myfile"]["name"])) //single file
          $fileName = $_FILES["myfile"]["name"];
        $ret[]= $fileName;
    else  //Multiple files, file[]
      $fileCount = count($_FILES["myfile"]["name"]);
      for($i=0; $i < $fileCount; $i++)
          $fileName = $_FILES["myfile"]["name"][$i];
          $ret[]= $fileName;
    echo json_encode($ret);
Discussion (1)0
Log in or sign up to continue