function printTree (array &$elements, $parentId = 0) {
$branch = array();
foreach ($elements as $element) {
if ($element['parent_id'] == $parentId) {
$children = $this->printTree($elements, $element['id']);
if ($children) {
$element['folder'] = true;
$element['children'] = $children;
}
$branch[] = $element;
}
}
return $branch;
}
formData.forEach(function(item, i, arr){
console.log(item+' '+i+' '+arr);
[Foto] => Array
(
[file] => Array
(
[0] =>
)
)