Created
September 27, 2019 15:07
-
-
Save MolloKhan/0df256534a4bb4c5f270e7689021ce66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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