Multiple file upload problem |
[eluser]zsela[/eluser]
Hi Everyone, I am pretty new at coding with CodeIgniter, but I pretty much enjoy it. However I ran into a problem on the other day which is related to multiple file uploading. My code doesn't want to work, when I want to upload multiple pictures and some additional input fields at the same time. I use an array as name for the pictures, but at the controller side the array seems to be empty. What is strange is that the $_FILE array does contain the uploaded pictures. Here is the relevant part of the view: Code: $attributes_pic = array('id' => 'upload_real_pic_form'); And here is the controller: Code: $config['upload_path'] = './images/uploads/realestates/'; If I printout $this->upload->data('pic') it is an empty array. What do I do wrong? Thanks for your replies in advanced!
[eluser]homebwoi[/eluser]
I'm not sure but as I know File Uploading library doesn't support multiple files upload, so there is the way I solve this problem: Code: // Get count of files
[eluser]zsela[/eluser]
Interesting idea. And how do you know, if something goes wrong with the upload (for example unsupported file type) which file was the faulty one? I looked at this topic, and it suggested me that multiple upload is somehow supported.
[eluser]homebwoi[/eluser]
If you want to know which file is faulty one you can add some code into cycle: Code: // Upload each file separately Maybe there are more efficient solutions, but I think that one is pretty simple
[eluser]zsela[/eluser]
Thanks for the quick replies! Unfortunately I wiil only have time to try this at the weekend, but as soon as I try it will post hte results here.
[eluser]zsela[/eluser]
Thanks for the tip again, it worked fine. Here is the solution, it might be handy for others in the future: Code: $config['upload_path'] = './images/uploads/realestates/'; Issue is closed! |
Welcome Guest, Not a member yet? Register Sign In |