• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple upload function

[eluser]Référencement Google[/eluser]
try to use a relative path, something like "./path/to/upload/" or maybe "path/to/upload".
As for your code, you make sure you have an "uploads" folder in the public root.

I have $upload_dir set as 'uploads'.. I've also tried './uploads' '/uploads' but those didn't do it either. The error handling from codeigniter isn't giving me much info to work with so I'm just sitting here scratching my head.

I mean I've done uploading before but that was one file at a time and I used the same $dir = 'uploads' so I don't think that's the problem.

the uploads folder is in the root folder where my styling and scripts folders are.

I'm also using MAMP and I've store this function in Application/libraries/MY_Upload, wich I've never done before.

[eluser]Référencement Google[/eluser]
As for the code you posted before, maybe your upload path should be set to "./costa/uploads/"

oh no that's not it, costa is the folder in my htdocs (MAMP) so costa is actually my root folder.
have you got a demo somewhere maybe?

[eluser]Référencement Google[/eluser]
Yeah but I am not sure how MAMP and CI manage that, I advice that you try to set paths with costa inside, maybe that will work.

Unfortunatly I don't have a live demo as for now I use Uploadify in Ajax for multiple uploads...

[eluser]Référencement Google[/eluser]
I think I know your problem, you should not put this code into a MY_Upload but into a Controller !
You can add that to a MY_Upload but then you'll have to adapt my code to use $this->do_upload() instead of things like $CI->upload->do_upload() (you'll have to call directly the methods from the parent class in fact)

oh my god you're right, it works now. You saved my day man, thank you soooo much!
I envy people who can see the problem so fast. There's probably a logical explaination here but still.

merci beaucoup!

[eluser]Référencement Google[/eluser]
You're welcome but hey I am not superman (yet) Smile


Thanks for the code, it works great but I think I missed something. It seems to re-name the multiple files from the name of the first file.

Here's a sample of the array it returns:

[0] => Array
[file_name] => vw-audi5.gif

[1] => Array
[file_name] => vw-audi5.gif.gif

I didn't change a lot from the code so I wonder what I did wrong... Could anybody help? Thank you


I just added the initialize of the config in the loop to make it work...



i have same problem, could you please help me Quentin Coeckelberghs

Done with the $this->upload->initialize($config);
Thanx for the clue

foreach($_FILES as $key => $value)



            if( ! empty($value['name']))


                if( ! $CI->upload->do_upload($key))



                    $data['upload_message'] = $CI->upload->display_errors(); // ERR_OPEN and ERR_CLOSE are error delimiters defined in a config file


                    echo $CI->upload->display_errors();

                    $errors = TRUE;




                    // Build a file array from all uploaded files

                    $files[] = $CI->upload->data();



            $this->upload->initialize($config);///---- added this here


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.