I have this form for multiple images here: http://www.comehike.com/account/upload_hike_photos.php?hike_id=58
And when I try to get the images in the POST processing of the request, I get these messages: Uninitialized string offset
This array does not get populat开发者_如何学JAVAed: $_FILES['uploadedfile']['name']
Any idea why? I have a very similar form like this working here: http://www.hikingsanfrancisco.com/account/upload_hike_photos.php?hike_id=58
But I can't quite figure out what the problem might be that makes the array of images be empty.
I think you need to end the name="uploadedfile" with a bracket so: "uploadedfile[]". Then you can go through the $_FILES['uploadedfile'] with foreach and put them in your server just like the other form.
EDIT: I've checked the source of your second link too, you have brackets in the second page you've provided. :)
I find dumping the contents of the array often helps see the structure. Try:
<?php echo '<pre>'.print_r($_FILES, true).'</pre>; ?>
However, that said, I think Tekin was on the right path. Try using a foreach or accessing the files directly like:
$_FILES['uploadedfile'][0]['name']
$_FILES['uploadedfile'][1]['name']
$_FILES['uploadedfile'][2]['name']
精彩评论