public static function dispatch(Http_Scriptlet_Context $context_, Uri $uri_) { $params = $uri_->getPathParams(); $storeName = array_shift($params); $categoryName = array_shift($params); $file = Io::fileUpload(); $store = Media::store($storeName); $store->add($file, $file->getName(), $categoryName); // TODO JSON echo $store->uri($file->getName(), $categoryName); }
static function upload() { $failed = []; foreach ($_FILES as $key => $file) { try { Io::fileUpload($key, self::temporaryUploadPath()); } catch (Io_Exception $e) { // FIXME Use exception message. $failed[$file['name']] = $file['error']; } } return $failed; }