Example #1
0
 /**
  * Upload new media.  
  * 
  * 
  * In remaking we need the url. As this is 
  * a PUT request no 'location' header would
  * be present [spec]
  *
  * we will need both the mediaName and url
  *
  * @param args
  * must contain fileName and file(path to file)
  */
 public function upload($args)
 {
     $args = Ensure::Input($args);
     $data = $args->get();
     $url = URIResource::Make($this->path, array($data["mediaName"]));
     if (isset($data['file'])) {
         $file = FileHandler::Read($data['file']);
     } else {
         $file = $this->data;
     }
     $this->client->put($url, $file);
     return Constructor::Make($this, array_merge(array("url" => $this->client->join($url)), $data));
 }