Uploading 2 files - 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: Uploading 2 files (/showthread.php?tid=50279) |
Uploading 2 files - El Forum - 03-21-2012 [eluser]peekk[/eluser] Hi! I have problem when i want to upload more than 1 file on my server, i have two fields for files in my form (userfile, userfile_watermark) my uploading code is: Code: if($_FILES['userfile_watermark']['size']>0){ and both files are uploaded to /sounds/watermark/ and their names are $new_filename_watermark (one should be just: $new_filename). I see that i want to load my library two times and probably that's wrong. How can i reload this or something like that? Cheers! Uploading 2 files - El Forum - 03-21-2012 [eluser]aquary[/eluser] Code: $this->load->library('upload'); Uploading 2 files - El Forum - 03-21-2012 [eluser]peekk[/eluser] It's still uploading file only from first upload initialization... Thx anyway! Any other ideas? How to clear the library initialization data nad initialize it again with another data? Uploading 2 files - El Forum - 03-22-2012 [eluser]peekk[/eluser] I was trying several other methods, but i just can't figure it out. Can someone tell me how to initialize this library again with new data? Uploading 2 files - El Forum - 03-22-2012 [eluser]PhilTem[/eluser] I never used the upload-class, but I think it's similar to the HTML-table class in terms of clearing. Try to do the clear before initializing the library. And maybe use Code: $this->upload->data(); rather than Code: $this->upload->do_upload(); for debugging. Uploading 2 files - El Forum - 03-22-2012 [eluser]aquary[/eluser] Are you sure the script actually goes into the second? Try echo something inside the second IF, then you could var_dump($_FILES) also. Uploading 2 files - El Forum - 03-22-2012 [eluser]LuckyFella73[/eluser] Did you try this to get details about the failure: Code: <?php An other thing (just thinking about folder permissions) you said: Quote:both files are uploaded to /sounds/watermark/ But your script has 2 different upload folders defined. Maybe one the folders has not the right permissions? (That's why I would implement the output of errors while trying to upload like suggested). Uploading 2 files - El Forum - 03-22-2012 [eluser]gRoberts[/eluser] Code: <? You'll find that when calling do_upload without any paramaters, it will be expecting an input file with a name of "userfile". The above will loop through each of the uploaded files and upload it accordingly (untested, but based on previous experiences, it should work). HTH |