CodeIgniter Forums
About class upload and multiple image input - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: About class upload and multiple image input (/showthread.php?tid=14697)



About class upload and multiple image input - El Forum - 01-12-2009

[eluser]Rubiz'[/eluser]
Hi all!!

I have a form that is working ok, I'm working with fields in format of arrays just like "work[]", and "images[]" for example.

My question is about using the upload class with this kind of array field.
I'm trying to do this:
Code:
$field_name = 'userfile[' . $i . ']';                    
if ( ! $this->upload->do_upload($field_name))
...
in a for looping, but its not working...

I'll have to name "userfile1", "userfile2", "userfile3" the inputs?
Sad


About class upload and multiple image input - El Forum - 01-12-2009

[eluser]dmorin[/eluser]
What does your view look like? Are you sure the field names are correct? Also, do a print_r($_POST) after the fields are posted and copy the output here for us to see.


About class upload and multiple image input - El Forum - 01-12-2009

[eluser]Rubiz'[/eluser]
I solved the problem making some javascript to name de fields like userfile1, userfile2, userfile3 as long as the final user chooses images.

Than I make the upload routine, with $input = 'userfile[' . $i . ']'; never works.