![]() |
Multiple file upload library - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Multiple file upload library (/showthread.php?tid=48157) |
Multiple file upload library - El Forum - 06-14-2012 [eluser]Ghetolobster[/eluser] Romy, This saved me a HUGE amount of time thank you. I have however run into a small issue. I want to save the filenames to a database but I cannot seem to figure out how to do so. Could you give me an example of how I would achieve this say with a table such as below Code: CREATE TABLE IF NOT EXISTS 'user_images' ( I forgot to mention this is my form Code: <?php echo form_open_mutlipart('site/upload'); Multiple file upload library - El Forum - 06-14-2012 [eluser]Romyblack[/eluser] [quote author="Ghetolobster" date="1339713712"]Romy, This saved me a HUGE amount of time thank you. I have however run into a small issue. I want to save the filenames to a database but I cannot seem to figure out how to do so. Could you give me an example of how I would achieve this say with a table such as below [/quote] Hi Ghetolobster, first at all thanks for taking this library in consideration to your projects. When you do this proccess. Code: $uploaded = $this->upload->up(TRUE); The $uploaded variable will contain an array with to more arrays, the SUCCESS files and the ERROR. so the SUCCESS contains the files that were uploaded correctly. so the only thing you have to do is to iterate and save it as you desire, for example. Code: foreach($uploaded['success'] as $file){ That's all hope its useful for you. just save that value into your data base ![]() Multiple file upload library - El Forum - 06-16-2012 [eluser]Ghetolobster[/eluser] [quote author="Romyblack" date="1339726997"] Code: $uploaded = $this->upload->up(TRUE); Romy, Thank you so much for this, I used this code and did the following for entering into the database. Code: if (count($uploaded['success']) > 0) Multiple file upload library - El Forum - 08-06-2012 [eluser]ogib[/eluser] Hello everybody, My file was named MY_Upload, and paste in folder library. NOT WORKq Message: Fatal error: Call to undefined method CI_Upload::up() in D:\xampp\htdocs\fpc\application\controllers\Utz_c.php on line 64 Please help Multiple file upload library - El Forum - 08-06-2012 [eluser]Romyblack[/eluser] [quote author="ogib" date="1344255294"]Hello everybody, My file was named MY_Upload, and paste in folder library. NOT WORKq Message:[removed]nullo(); Fatal error: Call to undefined method CI_Upload::up() in D:\xampp\htdocs\fpc\application\controllers\Utz_c.php on line 64 Please help[/quote] 1) Make sure you pasted the file at ./application/libraries/MY_Upload.php 2) Confirm if your code is similar to this one. Code: $this->load->library('upload'); Code: $config['subclass_prefix'] = 'MY_'; Multiple file upload library - El Forum - 08-06-2012 [eluser]ogib[/eluser] Quote:1) Make sure you pasted the file at ./application/libraries/MY_Upload.phpThat was my mistake! Many thanks! Works perfectly! Multiple file upload library - El Forum - 08-08-2012 [eluser]Unknown[/eluser] It is really a special one. I like the way you have presented the information. Interesting post. Thanks for sharing [url="http://www.wiks.com.au/anemometer"]wind meter[/url] Multiple file upload library - El Forum - 08-08-2012 [eluser]Romyblack[/eluser] [quote author="Rachel Gawith" date="1344433300"]It is really a special one. I like the way you have presented the information. Interesting post. Thanks for sharing[/quote] Thank you Rachel, ![]() ![]() Multiple file upload library - El Forum - 08-18-2012 [eluser]Unknown[/eluser] Hi.. Thank you for making the extended library for uploading files.. I tried to use your extended library, but unfortunately I got an error.. I wonder if you could help me resolve this.. Thanks a bunch.. (This is my error message) A PHP Error was encountered Severity: Notice Message: Uninitialized string offset: -1 Filename: libraries/MY_Upload.php Line Number: 85 (And this is what I wrote on my controller) Code: $config['upload_path'] = './image/upload/'; EDIT : My bad.. The upload path should be like './image/upload' instead of './image/upload/'.. Thx anyway.. Multiple file upload library - El Forum - 08-21-2012 [eluser]Pent[/eluser] Just registered to say this was exactly what I was looking for, thank you very much. I do however run in a minor issue, if there are multiple entries in the "error" array (the files that did not get uploaded) their error messages are concatenated, like this (I'm echoing the file names and the error messages): (filename1) The file you are attempting to upload is larger than the permitted size. (filename2) The file you are attempting to upload is larger than the permitted size. The file you are attempting to upload is larger than the permitted size. So the first error message under filename2 is actually the error message of filename1. I found out this happens because for uploading all the files, one instance of the upload class is used, and the error messages are just added together (because one file can have multiple error messages). It can be fixed by clearing the error array after merging it in the $uploaded_info, like this: Code: #Here we do the upload process |