![]() |
Weird problem with POST and the upload class - 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: Weird problem with POST and the upload class (/showthread.php?tid=30435) |
Weird problem with POST and the upload class - El Forum - 05-14-2010 [eluser]Cryorus[/eluser] Hi everyone. Well, im a newbie learning this thing, pretty cool indeed. The site: http://cryorus.ignavus.org/gedn/ In my admin panel, im trying to add news to the database with an image, submitting the info to my database. Submitting it was perfect till i added the file upload class, it uploads perfectly and i can still insert the info to the database, everything but the 'img' field. I did some debug and $this->input->post('img'), is empty. Now im insering to the database: "/resources/images/" Im using dwoo for templates, so im not using any php code in my view files. Here is my code. Controller: Code: function add() { View: Code: <div id="news"> Im pretty sure we dont need to know any of the other code. Thanks in advance. Edit: if in wrong section, please move, sorry. Weird problem with POST and the upload class - El Forum - 05-15-2010 [eluser]Cryorus[/eluser] This isnt an easy thing as it looks? Edit: Ok, i added the rule for the img field "required" and when i try to submit, i get an error saying that an image is required, so... something is removing the content inside my 'img' field. Anyone? Really thanks in advance, this is driving me crazy. Weird problem with POST and the upload class - El Forum - 05-20-2010 [eluser]deczo[/eluser] Hi there, i assume you want to insert into db uploaded file location, right? So you can't use: Code: 'img' => '/resources/images/' . $this->input->post('img'), Anyway in CI just use upload data helper, part of the upload library: after upload add: Code: $uploadDataArray = $this->upload->data(); Code: 'img' => '/resources/images/' . $uploadDataArray['file_name'], You can use $uploadDataArray['full_path'] instead, for details check http://ellislab.com/codeigniter/user-guide/libraries/file_uploading.html Weird problem with POST and the upload class - El Forum - 05-20-2010 [eluser]Cryorus[/eluser] Thank you, already did it this way, but i didnt know why $post didnt work. Thanks again. |