Skip to content

Instantly share code, notes, and snippets.

@MolloKhan
Created September 27, 2019 15:07
Show Gist options
  • Save MolloKhan/0df256534a4bb4c5f270e7689021ce66 to your computer and use it in GitHub Desktop.
Save MolloKhan/0df256534a4bb4c5f270e7689021ce66 to your computer and use it in GitHub Desktop.
public function upload(): string
{
if (strtolower($_SERVER['REQUEST_METHOD']) !== 'post') {
return $this->render($this->showForm());
}
if (!array_key_exists('newPicture', $_FILES) || !array_key_exists('author', $_POST)) {
return $this->error400();
}
// Process form
return $this->render(
$this->storeUploadedPicture(
$_FILES['newPicture'],
$_POST['author'],
$_POST['location']
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment