I got a problem with a multiple upload of images using a form.
The code works to upload 1 image (var_dump
of $_POST
& $_FILES
are ok and completed in action_gallery.php
), but it bugs when I want to upload more than 1 file (no more var_dump
and got undefined index error for my array pictures[]
).
I'm losing all info: no more $_POST
, no $_FILES
... except that everything goes well when I only got 1 picture. Someone got an idea where is my mistake?
HTML:
<form method="post" action="modele/action_gallery.php" enctype="multipart/form-data">
<table id="table_header_diaporama">
<tr>
<td align="center" colspan="3">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" /><input class="text_profile_form" type="file" name="pictures[]" multiple="multiple" />
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" /><input class="text_profile_form" type="file" name="pictures[]" multiple="multiple" />
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" /><input class="text_profile_form" type="file" name="pictures[]" multiple="multiple" />
</td>
</tr>
</table>
</form>
php.ini:
file_uploads = On
max_file_uploads = 20
upload_max_filesize = 100M
post_max_size = 100M
Thanks a lot.
Edit: I managed to recover my $_POST
switching enctype="multipart/form-data"
by enctype="application/x-www-form-urlencoded"
. Now, checking the content to see if I got everything ok.
Edit2: making $count = count($_FILES['pictures']['name']); echo '$count: '.$count;
gives me 0; so, my problem is still not sorted out! $_POST
ok now, but $_FILES
is still empty!
Edit3: I finally restored enctype="multipart/form-data"
switch off the computer for the night... and it was working afterwards... got no clue why know it works!!! (with 1 or more than 1 input lines to answer to timgavin!).