Je voudrais faire une boucle pour afficher le nom de plusieur image avant upload mais sa marche pas !
Code : Tout sélectionner
foreach ($_FILES['pictures'] as $key => $value)
{
echo $value;
}
Code : Tout sélectionner
foreach ($_FILES['pictures'] as $key => $value)
{
echo $value;
}
foreach ($_FILES as $key)
{
echo $key['name']; // Où $key correspond à l'attribut "name" de ta balise <input> de type "file"
}
Par exemple. éventuellement, montre le code du formulaire pour ces champs-là si ça ne fonctionne toujours pas.Code : Tout sélectionner
<input name="pictures" type="file" id="pictures">
</p>
<p>
<input name="pictures" type="file" id="pictures">
<label></label>
<br/>Code : Tout sélectionner
foreach ($_FILES as $key) {
echo $key['pictures'];
}Code : Tout sélectionner
array(1) { ["pictures"]=> array(5) { ["name"]=> array(2) { [0]=> string(10) "gateau.gif" [1]=> string(9) "fleur.gif" } ["type"]=> array(2) { [0]=> string(9) "image/gif" [1]=> string(9) "image/gif" } ["tmp_name"]=> array(2) { [0]=> string(45) "C:\DOCUME~1\gringo25\LOCALS~1\Temp\php3BC.tmp" [1]=> string(45) "C:\DOCUME~1\gringo25\LOCALS~1\Temp\php3BD.tmp" } ["error"]=> array(2) { [0]=> int(0) [1]=> int(0) } ["size"]=> array(2) { [0]=> int(1966) [1]=> int(2590) } } }Code : Tout sélectionner
array(1) {
["pictures"]=>
array(5) {
["name"]=>
array(2) {
[0]=>
string(9) "fleur.gif"
[1]=>
string(10) "gateau.gif"
}
["type"]=>
array(2) {
[0]=>
string(9) "image/gif"
[1]=>
string(9) "image/gif"
}
["tmp_name"]=>
array(2) {
[0]=>
string(45) "C:\DOCUME~1\gringo25\LOCALS~1\Temp\php3DA.tmp"
[1]=>
string(45) "C:\DOCUME~1\gringo25\LOCALS~1\Temp\php3DB.tmp"
}
["error"]=>
array(2) {
[0]=>
int(0)
[1]=>
int(0)
}
["size"]=>
array(2) {
[0]=>
int(2590)
[1]=>
int(1966)
}
}
}
Code : Tout sélectionner
foreach ($_FILES['pictures']['name'] as $key)
{
echo $key['name'];
}$nb = count($_FILES['pictures']['name']);
for($i = 0; $i < $nb; $i++)
{
echo($_FILES['picture']['name'][$i]);
}
?>
Essaye comme ça et dis moi si c'est pas mieux