CodeIgniter Forums
Multi Upload return TRUE - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Multi Upload return TRUE (/showthread.php?tid=73535)



Multi Upload return TRUE - googlemy - 05-05-2019

Hi CI Members,

I have issue when I submit form without upload any image and system not detect the input is empty,
But when I remove "[]" in name is work.

I hope CI Members can help me to solve my issue.

Code:
<input type="file" class="form-control-file" id="preview_image" name="preview_image[]" multiple>


PHP Code:
if (isset($_FILES['preview_image']['name'])
 
       && ($_FILES['preview_image']['name'] != '' || is_array($_FILES['preview_image']['name']) && count($_FILES['preview_image']['name']) > 0)) {
 
       if (!is_array($_FILES['preview_image']['name'])) {
            
            
//Upload Code
    
}

 
   return (bool) $totalUploaded

Thanks you...


RE: Multi Upload return TRUE - InsiteFX - 05-05-2019

Maybe this will help you out.

How to upload Multiple Files and Images in CodeIgniter


RE: Multi Upload return TRUE [Solved] - googlemy - 05-05-2019

Hi InsiteFX,

Thanks because try to help me.

Problem solved already..
PHP Code:
if ($_FILES["preview_image"]['name'][0] !== '') { 

Thanks