File field on groups, not return keys of "$_FILES"
Closed this issue · 2 comments
jeanmask commented
File field on groups, not return keys of "$_FILES", returns only file name, causing problems in validating and processing data.
bmidget commented
Can you give me an example of what you mean?
jeanmask commented
Code:
<?php
$form = Formo::form();
$form->add('file1', 'file');
$subform = Formo::form();
$subform->add('file2','file');
$subform->add('file3','file');
$form->add('subform', 'group', $subform);
$form->add('submit','submit');
if($_POST && $_FILES) {
$form->load();
echo Debug::vars($form->file1->val(), $form->subform->file2->val(), $form->subform->file3->val(),$_POST,$_FILES);
}
echo $form;
output on submit all fields:
array(5) (
"name" => string(59) "281597_137018173050486_100002269115813_239789_1633589_n.jpg"
"type" => string(10) "image/jpeg"
"tmp_name" => string(27) "C:\Windows\Temp\phpA7BE.tmp"
"error" => integer 0
"size" => integer 31539
)
array(5) (
"name" => string(0) ""
"type" => string(0) ""
"tmp_name" => string(0) ""
"error" => string(0) ""
"size" => string(0) ""
)
array(5) (
"name" => string(0) ""
"type" => string(0) ""
"tmp_name" => string(0) ""
"error" => string(0) ""
"size" => string(0) ""
)
array(1) (
"submit" => string(6) "submit"
)
array(3) (
"file1" => array(5) (
"name" => string(59) "281597_137018173050486_100002269115813_239789_1633589_n.jpg"
"type" => string(10) "image/jpeg"
"tmp_name" => string(27) "C:\Windows\Temp\phpA7BE.tmp"
"error" => integer 0
"size" => integer 31539
)
"file2" => array(5) (
"name" => string(56) "542664_2965272977553_1433496222_32194989_790872515_n.jpg"
"type" => string(10) "image/jpeg"
"tmp_name" => string(27) "C:\Windows\Temp\php2E33.tmp"
"error" => integer 0
"size" => integer 166288
)
"file3" => array(5) (
"name" => string(8) "acip.jpg"
"type" => string(10) "image/jpeg"
"tmp_name" => string(27) "C:\Windows\Temp\php2E43.tmp"
"error" => integer 0
"size" => integer 722595
)
)