php - Uploading files in CodeIgniter -


i have project based on codeignitor , im facing problem uploading forms cant attach more 1 files have upload fields attach user profile picture im trying duplacate filed attach 2 or more files no chance .

note changes in mvc files dublicated fields .

here field code

<?php                      if(isset($image))                          echo "<div class='form-group has-error' >";                     else                              echo "<div class='form-group' >";                 ?>                     <label for="qr" class="col-sm-2 control-label col-xs-8 col-md-2">                         <?=$this->lang->line("student_passport_pic")?>                     </label>                     <div class="col-sm-4 col-xs-6 col-md-4">                         <input class="form-control"  id="uploadfile" placeholder="choose file" disabled />                       </div>                      <div class="col-sm-2 col-xs-6 col-md-2">                         <div class="fileupload btn btn-success form-control">                             <span class="fa fa-repeat"></span>                             <span><?=$this->lang->line("upload")?></span>                             <input id="uploadbtn" type="file" class="upload" name="image" />                         </div>                     </div>                      <span class="col-sm-4 control-label col-xs-6 col-md-4">                          <?php if(isset($image)) echo $image; ?>                     </span>                 </div> 

please advice need upload many files .

if want multiple images same field. make input field name array.

for ex : first upload field should below

<input id="uploadbtn" type="file" class="upload" name="image[]"/> 

then, input field generating should of same name

<input id="uploadbtn" type="file" class="upload" name="image[]"/> 

and in controller taking post value, can take values of field using $this->input->post('image') give image names.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -