0

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/>&nbsp;&nbsp;
    <button name="update_photo" class="button1" type="submit">
    <span><span><?php echo translate("Upload"); ?></span></span></button>
    </p>
</form>
1
  • i think this would be help link1. link2 Commented Dec 18, 2013 at 7:29

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.