drisate Posted February 16, 2009 Share Posted February 16, 2009 I am trying to do a multiple file uploader ... every imput has the name userfile[] foreach ($_FILES['userfile'] as $fi){ if (is_uploaded_file($fi['tmp_name'])) { Attach($fi['tmp_name'],$fi['name']); } } For some reason $fi['tmp_name'] returns null bot not $_FILES['userfile']['tmp_name'] ... Quote Link to comment https://forums.phpfreaks.com/topic/145438-solved-foreach-_files/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 16, 2009 Share Posted February 16, 2009 The array will be $_FILES['userfile']['tmp_name'][0], $_FILES['userfile']['tmp_name'][1]... You need to do - foreach($_FILES['userfile']['tmp_name'] as $key => $value){ } You can use the $key inside of the loop to access the other elements - $_FILES['userfile']['error'][$key] $_FILES['userfile']['size'][$key] $_FILES['userfile']['name'][$key] Quote Link to comment https://forums.phpfreaks.com/topic/145438-solved-foreach-_files/#findComment-763493 Share on other sites More sharing options...
drisate Posted February 16, 2009 Author Share Posted February 16, 2009 Thks works like a charme ;-) Quote Link to comment https://forums.phpfreaks.com/topic/145438-solved-foreach-_files/#findComment-763533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.