public function request($verb, array $params = []) { parent::request($verb, $params); if ($verb == \Carbo\Http\Verb::Post) { mkdir($this->folder->path . DIRECTORY_SEPARATOR . basename($_POST['name'])); $this->headers['Location'] = '../' . basename($_POST['name']) . '/'; $this->created = true; } }
public function request($verb, array $params = []) { parent::request($verb, $params); if ($verb == \Carbo\Http\Verb::Post) { $file = $_FILES['file']; move_uploaded_file($file['tmp_name'], $this->folder->path . DIRECTORY_SEPARATOR . $file['name']); $this->headers['Location'] = '..'; $this->code = \Carbo\Http\Code::Found; } }
public function request($verb, array $params = []) { parent::request($verb, $params); $this->item = $params['file']; if ($verb == \Carbo\Http\Verb::Post) { foreach ($this->folder->files as $file) { if ($file->name === $this->item) { $this->headers['Location'] = '../..'; $this->code = \Carbo\Http\Code::Found; $file->delete(); $this->deleted = true; } } } }