Я запускаю этот код для регулярного выражения:
array('fileType'=>array('$regex'=>'^image'))
И этот код в целом:
foreach ($this->grid->find(array('fileType'=>array('$regex'=>'^image'))) as $file) {
$id = (string) $file->file['_id'];
$filename = htmlspecialchars($file->file["filename"]);
$filetype = isset($file->file["filetype"]) ? $file->file["filetype"] : 'application/octet-stream';
if($filetype == 'image/'.$chosenfile.''){
$links[] = sprintf('
', $id);
}elseif($chosenfile == ''){
$links[] = sprintf('
', $id);
}
}
Подробнее здесь: https://stackoverflow.com/questions/112 ... -php-query
Мобильная версия