Added hasUploadedFile method to FormContent.

This commit is contained in:
flash 2023-08-22 00:04:20 +00:00
parent 208446b544
commit 6a38f803f4
2 changed files with 6 additions and 2 deletions

View file

@ -1 +1 @@
0.2308.212025
0.2308.220004

View file

@ -1,7 +1,7 @@
<?php
// FormContent.php
// Created: 2022-02-10
// Updated: 2023-08-21
// Updated: 2023-08-22
namespace Index\Http\Content;
@ -35,6 +35,10 @@ class FormContent implements IHttpContent {
return http_build_query($this->postFields, '', '&', $spacesAsPlus ? PHP_QUERY_RFC1738 : PHP_QUERY_RFC3986);
}
public function hasUploadedFile(string $name): bool {
return isset($this->uploadedFiles[$name]);
}
public function getUploadedFile(string $name): HttpUploadedFile {
if(!isset($this->uploadedFiles[$name]))
throw new RuntimeException('No file with name $name present.');