I've got two different forms, with two different file uploads.
<form action="index.php" method="post">
<input type="hidden" name="id" value="form1">
<input type="file" name="form1" id="form1">
</form>
<form action="index.php" method="post">
<input type="hidden" name="id" value="form2">
<input type="file" name="form2" id="form2">
</form>
This is my php code
switch ($_POST['id']) {
case 'form1':
echo basename($_FILES["form1"]["name"]);
//Output gives me the filename
break;
case 'form2':
echo basename($_FILES["form2"]["name"]);
//Output is empty
break;
}
When I'm trying to get the filename of the second form, it outputs nothing.
Thanks for helping!