Form with file filed in CakePHP
How get name of field type file in beforeSave()? I have for开发者_运维技巧m with many file filed, and i must get names of each...
Well, that obviously depends on what name you give it. If that's unknown, you can simply loop through the data array and pick the one that looks like a file array:
foreach ($this->data[$this->alias] as $field => $contents) {
if (isset($contents['tmp_name'])) {
// This is the $field you're looking for
}
}
精彩评论