I want to upload multiple files in a single submit button using PHP but its not working and i had tried upload a single file using php and it was working well so i thought that it would be good to just copy the same code for the second file to have two files uploaded but in vain.
i had tried this solution on SO but i had no success :solution1
<form action="" method="post" target="frame" enctype = "multipart/form-data">
<div class="buttonsend">
<p>Entrez votre fichier.cfg :</p>
<input type = "file" name = "cfg" /></br>
<p>Entrez votre fichier.dat :</p>
<input type = "file" name = "dat" /></br></br>
<button id="send" type="submit" name="send">Générer</button>
</div>
</form>
<?php
if (isset($_POST['send'])) {
$file_tmpcfg = $_FILES['cfg']['tmp_name'];
$file_namecfg = $_FILES['cfg']['name'];
move_uploaded_file($file_tmpcfg,"/home/imagesdcard/www/".$file_namecfg);
$file_tmpdat = $_FILES['dat']['tmp_name'];
$file_namedat = $_FILES['dat']['name'];
move_uploaded_file($file_tmpdat,"/home/imagesdcard/www/".$file_namedat);
}
?>