<form action="" method="post" enctype="multipart/form-data">
<input type="" name="fname" />
<input type="file" name="filepath" id="filepath"/><br><br>
<input type="submit" name="SubmitButton" value="Submit"/>
</form>
-----------------php-----------------------------------
$newname=$_POST['fname'];
$target_dir = 'uploads/reports/';
$filename=$_FILES["filepath"]['name'];
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$_FILES["filepath"]['name']=$newname.".".$ext;
$target_file = $target_dir . basename($_FILES["filepath"]['name']);
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$_FILES["tmp_name"]=$newname;
echo $target_file;
move_uploaded_file($_FILES["filepath"]["tmp_name"], $target_file);
}
i need to upload multiple files (excel,word documents,images) from single input(i mean , we could select multiple files when we browse) to database , this code is work only for one file.and rename that file as $newnam(1),$newname(2).... like that