Upload final readonly class
Minn\Media\Upload · public/minn/src/Minn/Media/Upload.php · 89 lines
One file arriving for the library, on either transport: a multipart field named "file" (a temporary upload to move) or a raw body whose Content-Disposition names the file. The parent is read from the same request, wherever the client put it.
Constants and properties
| prop | readonly string $filename | Promoted from the constructor. |
| prop | readonly ?string $movedFrom | Promoted from the constructor. |
| prop | readonly ?string $raw | Promoted from the constructor. |
| prop | readonly int $parent | Promoted from the constructor. |
Public
| new | __construct(string $filename, ?string $movedFrom, ?string $raw, int $parent = 0)# | ||||
| static | fromRequest(Minn\Http\Request $request): ?self# | Null when the request carries no file. | |||
| static | filenameFrom(array $headers): ?string# | The file a Content-Disposition names, as the reference reads one (probe rest-attachments-controller): the parameters after the disposition type, split on semicolons as written; the last non-empty filename= of all the headers, unquoted when double quotes wrap it. "filename" is matched as written, and filename* is not read. Null when none names one.
| |||
| static | refusal(string $data, array $headers): ?Minn\RestError# | Why a raw body cannot be taken, in the reference's order: no data, no Content-Type, no Content-Disposition, one naming no file, a Content-MD5 the data does not match. Null when it can. The headers are the REST request's, keyed by lower-case names with underscores.
| |||
| method | mime(): ?string# | The mime type the extension maps to, or null for one the library refuses. | |||
| static | parentOf(Minn\Http\Request $request): int# | The post the client wants the file attached to: form field, query, or JSON body. |
Nothing matches.