Storing image filename to DB along with other data |
[eluser]RockyS[/eluser]
Hello, I have a form with multiple inputs (text) and one file input(for images) what I would like to do is to store image filename to DB with other submitted data, this is my controller http://pastebin.com/K6s34xRe and my model http://pastebin.com/9ddj4uTX (method "dodaj_sliko() is save_image() in english) My field for files is Code: <input type="file" name="file_upload_manual_slike" multiple /> So the main question is, how can I accomplish this, because above code that I posted doesn't work :-S
[eluser]Oscar Dias[/eluser]
Hi, I think that your upload is not executed because it is right after a redirect: Code: redirect($this->config->item('base_url'), 'refresh'); The redirect function has an exit, which means it will stop execution after it. Code: function redirect($uri = '', $method = 'location', $http_response_code = 302) You need to do the upload before the redirect.
[eluser]ppwalks[/eluser]
are you using codeigniters upload class if so you pass the variable to the model like this, here is mine using "do_upload": Model: Code: function add_product($file_name) { Code: if (!empty($_FILES['product_thumb'])) Code: $this->MProducts->add_product($file_name); |
Welcome Guest, Not a member yet? Register Sign In |