Created
April 1, 2019 18:13
-
-
Save GDmac/f8e6d2fb96a3dfb80102cad831bcb760 to your computer and use it in GitHub Desktop.
composing objects and make methods and objects testable
This file contains hidden or 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
<?php | |
require_once __DIR__ . '/../vendor/autoload.php'; | |
$uploadHandler = new \Acme\FileUpload\UploadHandler(); | |
$uploadHandler | |
->setFormFieldName('upload') | |
->setTargetDirectory(__DIR__ . '/../uploads') | |
->addValidator(new JpegFileTypeValidator()) | |
->addValidator(new maxFileSizeValidator(4096)) | |
->addValidator(new fileExistsValidator()); // don't overwrite existing uploads | |
// ... | |
$uploadHandler->handle($_FILES); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment