Reputation: 171
Now im working on multiple file uploaded with Codeigniter
any one can help me? because when i'm uploading my file just single file readed.
foreach ($_FILES[$field]['tmp_name'] as $f => $tmp_name) {
//in here just single file can readed
}
and this is the html code
<form enctype="multipart/form-data"
action="<?php echo site_url('rooms/edit_photo/' . $room_id); ?>" method="post"
onsubmit="return AIM.submit(this, {'onStart' : startCallback, 'onComplete' : completeCallback})">
<p><label id="upload_photo"
for="new_photo"><?php echo translate("Upload photo"); ?></label>
<input name="userfile[]" size="24" type="file" multiple/>
<button name="update_photo" class="button1" type="submit">
<span><span><?php echo translate("Upload"); ?></span></span></button>
</p>
</form>
Upvotes: 0
Views: 120
Reputation: 307
You should try to see what's currently in the $_FILES
variable. You can do this with print_r($_FILES)
or var_dump($_FILES)
Looks to me that this should be an array, so you're data is probably in this format:
// for the first picture
$_FILES[$field]['tmp_name'][0]
Furthermore: do you know CodeIgniter supplies a uploads library? http://ellislab.com/codeigniter%20/user-guide/libraries/file_uploading.html
Upvotes: 2