Notice: Undefined offset: 3 on line 6
line 6 is the following:
$tmpFilePath = $_FILES['file']['tmp_name'][$i];
Here’s all you should need:
session_start();
//Loop through each file
for($i=0; $i<count($_FILES['file']); $i++) {
//Get the temp file path
$tmpFilePath = $_FILES['file']['tmp_name'][$i];
//Make sure we have a filepath
if ($tmpFilePath != ""){
//Setup our new file path
$newFilePath = "./uploaded_files/" . $_FILES['file']['name'][$i];
//Upload the file into the temp dir
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
echo "Upload Successful!<br />";
}
}
}
Check to see if it exists: