How to perform the upload with multiple files |
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)
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
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 :) (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/'; |
Welcome Guest, Not a member yet? Register Sign In |