Two problems:
1. How can I check whether I receive a Single file input array or a Multiple files input array from a form?
2. How can I change the Single file input array into the Multiple files input array?
Single file input array,
Multiple files input array,PHP Code:Array
(
[file] => Array
(
[name] => Around the Shoreline of Plymouth01.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp\tmp\php7FC5.tmp
[error] => 0
[size] => 258246
)
)
PHP Code:Array
(
[file] => Array
(
[name] => Array
(
[0] => Around the Shoreline of Plymouth01.jpg
)
[type] => Array
(
[0] => image/jpeg
)
[tmp_name] => Array
(
[0] => C:\wamp\tmp\phpFF9D.tmp
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 258246
)
)
)
This is what I came out with but it is still not correct...
result:PHP Code:$array = array();
foreach ($_FILES as $key => $fileItSelf)
{
foreach ($fileItSelf as $key => $value)
{
$array[] = array($key => $value);
//$value[]
}
}
print_r($array);
Thanks,PHP Code:Array
(
[0] => Array
(
[name] => Around the Shoreline of Plymouth01.jpg
)
[1] => Array
(
[type] => image/jpeg
)
[2] => Array
(
[tmp_name] => C:\wamp\tmp\php4C50.tmp
)
[3] => Array
(
[error] => 0
)
[4] => Array
(
[size] => 258246
)
)
Lau



Reply With Quote
Bookmarks