1 | <?php |
||
18 | class UploadedFile |
||
19 | { |
||
20 | /** |
||
21 | * @var string original name on the client machine |
||
22 | */ |
||
23 | protected $name; |
||
24 | |||
25 | /** |
||
26 | * @var string mime type |
||
27 | */ |
||
28 | protected $type; |
||
29 | |||
30 | /** |
||
31 | * @var int in bytes |
||
32 | */ |
||
33 | protected $size; |
||
34 | |||
35 | /** |
||
36 | * @var string local filepath to the temporary file |
||
37 | */ |
||
38 | protected $tmp_name; |
||
39 | |||
40 | /** |
||
41 | * @var string one of https://secure.php.net/manual/en/features.file-upload.errors.php |
||
42 | */ |
||
43 | protected $error; |
||
44 | |||
45 | public function __construct($php_file_info) |
||
57 | |||
58 | /** |
||
59 | * Makes sure the input has the desired key and casts it as the appropriate type. |
||
60 | * @since $VID:$ |
||
61 | * @param $php_file_info_array |
||
62 | * @param $desired_key |
||
63 | * @param string $cast_as "string" or "int" |
||
64 | * @return int|string |
||
65 | * @throws InvalidArgumentException |
||
66 | */ |
||
67 | protected function extractFromArrayOrThrowException($php_file_info_array, $desired_key, $cast_as = 'string') |
||
86 | |||
87 | /** |
||
88 | * @return string |
||
89 | */ |
||
90 | public function getName() |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getType() |
||
102 | |||
103 | /** |
||
104 | * @return int |
||
105 | */ |
||
106 | public function getSize() |
||
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | public function getTmpName() |
||
118 | |||
119 | /** |
||
120 | * @return string |
||
121 | */ |
||
122 | public function getError() |
||
126 | |||
127 | /** |
||
128 | * @since $VID:$ |
||
129 | * @return string |
||
130 | */ |
||
131 | public function __toString() |
||
135 | } |
||
136 | // End of file UploadedFile.php |
||
138 |