Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
File 用CakePHP文件归档的表单_File_Cakephp_Forms - Fatal编程技术网

File 用CakePHP文件归档的表单

File 用CakePHP文件归档的表单,file,cakephp,forms,File,Cakephp,Forms,如何在beforeSave()中获取字段类型文件的名称? 我有很多文件归档的表单,我必须得到每个表单的名称…好吧,这显然取决于你给它起的名字。如果未知,您只需在数据数组中循环并选择一个看起来像文件数组的数组: foreach ($this->data[$this->alias] as $field => $contents) { if (isset($contents['tmp_name'])) { // This is the $field you'r

如何在beforeSave()中获取字段类型文件的名称?
我有很多文件归档的表单,我必须得到每个表单的名称…

好吧,这显然取决于你给它起的名字。如果未知,您只需在数据数组中循环并选择一个看起来像文件数组的数组:

foreach ($this->data[$this->alias] as $field => $contents) {
    if (isset($contents['tmp_name'])) {
        // This is the $field you're looking for
    }
}

你的问题不清楚,而且你有一些令人困惑的打字错误(文件归档?)。请重新措辞,不。我想获取数据的名称[ModelName][get_this_name][tmp_name]