1 | <?php |
||
15 | class UploadedFile |
||
16 | { |
||
17 | /** |
||
18 | * The uploaded file type |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $sType; |
||
23 | |||
24 | /** |
||
25 | * The uploaded file name, without the extension and slugified |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $sName; |
||
30 | |||
31 | /** |
||
32 | * The uploaded file name, with the extension |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $sFilename; |
||
37 | |||
38 | /** |
||
39 | * The uploaded file path |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $sPath; |
||
44 | |||
45 | /** |
||
46 | * The uploaded file size |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $sSize; |
||
51 | |||
52 | /** |
||
53 | * The uploaded file extension |
||
54 | * |
||
55 | * @var string |
||
56 | */ |
||
57 | protected $sExtension; |
||
58 | |||
59 | /** |
||
60 | * Create an instance of this class using data from the $_FILES global var. |
||
61 | * |
||
62 | * @param string $sUploadDir The directory where to save the uploaded file |
||
63 | * @param array $aFile The uploaded file data |
||
64 | * |
||
65 | * @return UploadedFile |
||
66 | */ |
||
67 | public static function fromHttpData($sUploadDir, array $aFile) |
||
78 | |||
79 | /** |
||
80 | * Convert the UploadedFile instance to array. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function toTempData() |
||
95 | |||
96 | /** |
||
97 | * Create an instance of this class using data from an array. |
||
98 | * |
||
99 | * @param array $aFile The uploaded file data |
||
100 | * |
||
101 | * @return UploadedFile |
||
102 | */ |
||
103 | public static function fromTempData(array $aFile) |
||
114 | |||
115 | /** |
||
116 | * Slugify a text |
||
117 | * |
||
118 | * @var string |
||
119 | */ |
||
120 | protected function slugify($sText) |
||
125 | |||
126 | /** |
||
127 | * Get the uploaded file type |
||
128 | * |
||
129 | * @return string |
||
130 | */ |
||
131 | public function type() |
||
135 | |||
136 | /** |
||
137 | * Get the uploaded file name, without the extension and slugified |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | public function name() |
||
145 | |||
146 | /** |
||
147 | * Get the uploaded file name, with the extension |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | public function filename() |
||
155 | |||
156 | /** |
||
157 | * Get the uploaded file path |
||
158 | * |
||
159 | * @return string |
||
160 | */ |
||
161 | public function path() |
||
165 | |||
166 | /** |
||
167 | * Get the uploaded file size |
||
168 | * |
||
169 | * @return string |
||
170 | */ |
||
171 | public function size() |
||
175 | |||
176 | /** |
||
177 | * Get the uploaded file extension |
||
178 | * |
||
179 | * @return string |
||
180 | */ |
||
181 | public function extension() |
||
185 | } |
||
186 |