-
Notifications
You must be signed in to change notification settings - Fork 2
Upload
Viames Marino edited this page Feb 23, 2026
·
1 revision
Pair\Helpers\Upload manages uploaded files from form fields.
It validates upload status and provides local or S3 save helpers.
Initializes upload object from $_FILES[$fieldName].
Saves file locally.
Uploads file using provided AmazonS3 service.
Returns last upload-related error.
use Pair\Helpers\Upload;
$upload = new Upload('avatar');
if (!$upload->save(APPLICATION_PATH . '/public/uploads', null, true)) {
throw new \Exception($upload->getLastError() ?? 'Upload failed');
}S3 example:
$upload->saveS3('avatars/user-42.jpg', $amazonS3);