Upload multiple images on anchor click

651 views Asked by At

I want to upload multiple images on anchor tag click. I am able to upload multiple images on div and image tags using ng-file-upload

Can anybody please suggest me how to upload multiple images on anchor tag click.

<a href=""><i class="fa fa-camera"></i></a>

Edited

<a href="">
     <i class="fa fa-camera">
       <div  type="file"  ng-show="false" ngf-select  ng-model="profilePic.profileImageUrl"  ngf-max-size='2000000'>
       <img   ngf-src="profilePic.profileImageUrl[0]" ngf-default-src="../images/people/110/default_profile.png" height="100" width="100" class="fa fa-camera"></div>
      </i>
     </a>
1

There are 1 answers

1
Luis On

https://github.com/stvnthomas/CodeIgniter-Multi-Upload

See if this website could help you out.

I found also this code that you need do is change the name of the file tag to array like

<input type="file" name="userfile[]" multiple="multiple" class="btn btn-file"/>

and then you need to put the upload code into foreach as shown below

foreach($_FILES['userfile'] as $file)
{
   if (!$this->upload->do_upload($file)) {
        $error = array('error' => $this->upload->display_errors());
        .
        .
        .

      }
}

See if this could help you out. I'm new in the subject but I searched for a while and this could help you I think.