CodeIgniter Forums
codeigniter 4 upload multiple images to save data in blob with comma - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: codeigniter 4 upload multiple images to save data in blob with comma (/thread-79397.html)



codeigniter 4 upload multiple images to save data in blob with comma - debabrata542 - 06-09-2021

[font=-apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif]controller[/font]
Code:
public function upload_multiple_files() {
        if($this->request->getPost('files_upload')) {
              $files = $this->request->getFiles();
                $img = $files['multiple_files'];
              foreach($img as $im){
                    $name= $im->getName();
                        $im->move('assets/imgs', $name);           
                    $userdata = [
                        'title' => $this->request->getPost('title'),
                        'img' => $name
                      ];

                      $this->imageModel->insert($userdata);
            }
        }
        echo view('files_upload');
    }
[font=-apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif]View[/font]
Code:
<?php
            echo form_open_multipart('filesupload/upload_multiple_files', array('id' => 'upload-multiple-files'));
            ?> 
                            <input type="text" name="title" id="title"/>

                    <lable>Upload Multiple Files</lable>
                            <input type="file" name="multiple_files[]" id="multiple_files" readonly="true" multiple/>
                        <input type="submit" name="files_upload" value="Upload Files"/>
            </form>
[font=-apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif]Table:[/font]
[font=-apple-system, BlinkMacSystemFont, "Segoe UI", "Liberation Sans", sans-serif]want database image name like: a.jpg,b.jpg,c.jpg inside blob[/font]