I am trying to insert a key index to FILE array. I just want to know that is this work in FILE array or not ?
$files = $_FILES;
print_r($files);
Array
(
[image] => Array
(
[name] => 400.png
[type] => image/png
[tmp_name] => /tmp/php5Wx0aJ
[error] => 0
[size] => 15726
)
)
what i want is like this below:
$files = $_FILES;
print_r($files);
Array
(
[image] => Array
(
[name] => 400.png
[type] => image/png
[tmp_name] => /tmp/php5Wx0aJ
[error] => 0
[size] => 15726
[myid]=> my value
)
)
Is it possible to push key index into $_FILE
array with the PHP function?
Yes, you can do it as follows:
$files['image']['myid'] = 'my value';
IIRC, the 'image' key to the $_FILES array is the name of the control in your HTML, if you were just looking for a way to identify which of multiple files is which.