printf('<pre>%s</pre>', print_r($_FILES,1)); //this works great, I wish there was a concise book to tell you tricks like this, sorry I learnt by trial and error (lots) and a couple books. Recommendations of a good manual??
Ok so I tried this and it gave me a breakdown of the individual array elements, and the fact $_FILES was containing arrays, as expected. The thing was that even with no files selected there was still the additional level of arrays.
Array
(
[image] => Array
(
[name] => Array
(
[0] =>
)
[type] => Array
(
[0] =>
)
[tmp_name] => Array
(
[0] =>
)
[error] => Array
(
[0] => 4
)
[size] => Array
(
[0] => 0
)
)
)
This is the form submitted with nothing.
Array
(
[image] => Array
(
[name] => Array
(
[0] => IMG_2968.JPG
[1] => IMG_2969.JPG
)
[type] => Array
(
[0] =>
[1] =>
)
[tmp_name] => Array
(
[0] =>
[1] =>
)
[error] => Array
(
[0] => 2
[1] => 2
)
[size] => Array
(
[0] => 0
[1] => 0
)
)
)
This is with two files, the "tmp_name" is blank, so my earlier checks to use this to see if anything was selected would obviously fail.
However the "name" array contains at least something to check, its null if no file selected and something if a file is selected, allowing me to then have picture checks etc etc.
I checked with this:
if($_FILES["image"]["name"][0] != null){
echo 'you selected at least one file<br />';
echo count($_FILES["image"]["name"]);
}else{
echo 'you must select at least one file';
}
This works great and gives me what I was expecting initially. All I can say is thank you for the help, but if you have suggestions on a good reference manual to good php functions I would appreciate it to build my knowledge with more advanced coding, it would probably save me a lot of coding with if's....