Multiple upload function - 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 upload function (/showthread.php?tid=6215) |
Multiple upload function - El Forum - 02-18-2008 [eluser]Référencement Google[/eluser] Hi, I give a piece of code that can be usefull for some people that will want to take the time understanding the function. It upload files coming from a multiple upload form and if all ok return a files array, other wise delete the uploaded files from server. It's sure far from perfect and I release it as is, it's part of an application I have developped, so if you are interrested about use this function, you must of course adapt it for your application. Also note that I will answer basic questions about it, but I won't give any other kind of support for this. Code: function multiple_upload($upload_dir = 'uploads', $config = array()) Sample usage: Code: if( ! $files = $this->upload->multiple_upload('public/photos')) Multiple upload function - El Forum - 07-17-2008 [eluser]CARP[/eluser] Hi Too Pixel I've tried your library, and worked great! But, how would you modify its code for example to Allow user to submit from 1 to 5 images. I mean, I've made a userfile[] set of 5 upload fields in my form, the first one is mandatory, but the other 4 not. But when I use your lib, I get errors, because it requires the user to select 5 images, 1 for each upload field... Thanks a lot in advance, Multiple upload function - El Forum - 07-17-2008 [eluser]Référencement Google[/eluser] Here is a sample part of a form that I use with this library Code: <?php Multiple upload function - El Forum - 07-17-2008 [eluser]CARP[/eluser] Puff! Just naming the upload fields from userfile[] to userfile1, userfile2... etc. solved the problem!! 1. I thought the upload files should be named userfile 2. and that they had to been toghether in an array... Thanks! Multiple upload function - El Forum - 07-17-2008 [eluser]Référencement Google[/eluser] Cool that it works ! Multiple upload function - El Forum - 02-20-2009 [eluser]Unknown[/eluser] Thanks for this script! Great it's work, I can uploading more than one images in one time but I got a problem when I try uploading some zip and pdf file, Multiple upload function - El Forum - 02-20-2009 [eluser]pistolPete[/eluser] [quote author="chero" date="1235136815"]I got a problem when I try uploading some zip and pdf file[/quote] You have to adjust Code: $config['allowed_types'] = 'gif|jpg|jpeg|jpe|png'; Multiple upload function - El Forum - 02-23-2009 [eluser]Unknown[/eluser] Conditional not need: Code: if( ! empty($value['name'])) Multiple upload function - El Forum - 02-23-2009 [eluser]Référencement Google[/eluser] [quote author="lusever" date="1235404723"]Conditional not need: Code: if( ! empty($value['name'])) Yes that's right, thanks for seeing this one. Multiple upload function - El Forum - 10-05-2009 [eluser]artlover[/eluser] thanks for great code. but I also need to save it to database. so I need the name of files :/ how can I get the names? ps, if there is already same named file at folder, it automatically rename the file... in this case, I need renamed file name :/ appreciate helps!! |