![]() |
How to perform the upload with multiple files - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11) +--- Thread: How to perform the upload with multiple files (/showthread.php?tid=65830) |
How to perform the upload with multiple files - tianhe - 07-29-2016 I use the following code in my form . Code: <input type="file" name="bbs_images[]"> I tried PHP Code: $this->upload->do_upload('bbs_images'); and got Code: Message: is_uploaded_file() expects parameter 1 to be string, array given I also tried PHP Code: $this->upload->do_upload('bbs_images[0]'); So, How could I use Upload::do_upload since the structure of $_FILES['bbs_images'] is as follows ? PHP Code: array (size=5) RE: How to perform the upload with multiple files - Ivo Miranda - 07-29-2016 I'm not used to use CI file upload but it seems you are in trouble since do_upload() seems to be made to one file only... I would suggest: 1) Do a method to save $_FILES into another var and then try to override $_FILES with the proper structure and call do_upload on each file? Seems very clumsy but maybe it's possible to do this? I dunno... 2) Create another method similar to do_upload but prepared to receive that array of files. 3) Use another library like https://github.com/blueimp/jQuery-File-Upload RE: How to perform the upload with multiple files - rikyperdana - 08-21-2016 Let me show you mine : For the View : Code: <input type="file" multiple name="userfile[]" size="20"/> For the controller : Code: $upload['upload_path'] = './uploads/'; Try upload some pics, if the pics you choose goes to 'uploads' folder, you did it If it works for me, it should work for you too :) RE: How to perform the upload with multiple files - eleumas - 09-13-2017 (08-21-2016, 11:08 AM)rikyperdana Wrote: Let me show you mine : Hi, i have used your method and work very good but i don't know how to attach more files an e-mail. Can you help me please? PHP Code: $config['upload_path'] = './media/images/uploads/'; |