Upload images along with my news items ? |
[eluser]invision[/eluser]
OK, I've now managed to get 90% of it working ![]() My current code..... Controller(snippet): Code: function create(){ Model(snippet): Code: function addNews(){ Tiny final issue. If I want to send the filename value to my addNews method in my News model, how would I do this? Many thanks for any help.
[eluser]farinspace[/eluser]
By the looks of your code you would use the following: Code: $file_name = !empty($data['upload_data']) ? $data['upload_data']['file_name'] : NULL ; Take a look at the File Uploading Class section of the user guide (scroll to the bottom of the page, for all the params you can use): http://ellislab.com/codeigniter/user-gui...ading.html
[eluser]invision[/eluser]
Thanks for the reply. Just to confirm, my Controller would be something like this: Code: ... Would I need to make alts to my addNews function in the model? Like... Code: 'title' => $this->input->post('title'), Thanks again for your help.
[eluser]invision[/eluser]
Hey farinspace, Can you give me a little bit more help with this? Thank you.
[eluser]farinspace[/eluser]
Your addNews function would be something like this (you'll have to test the code of course): Code: function addNews($file_name) ...and remember to uncomment your code: Code: else
[eluser]invision[/eluser]
Wow, brilliant!!!! Many thanks farinspace, you've just made my day ![]() Thank you |
Welcome Guest, Not a member yet? Register Sign In |