Only upload if user set a value - 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: Only upload if user set a value (/showthread.php?tid=34823) |
Only upload if user set a value - El Forum - 10-10-2010 [eluser]Corbee[/eluser] Hi, I'm doing a file upload, and I needed it to only upload if the user has set a value to the image. I tried using Code: if ($this->input->post('logo')) but if you do an echo on the $this->input->post('logo'); you'll realize that it is always blank whether user sets it or not. What's wrong with my code? Thanks Only upload if user set a value - El Forum - 10-10-2010 [eluser]techgnome[/eluser] Does using isset work? Code: if (isset($this->input->post('logo'))) -tg Only upload if user set a value - El Forum - 10-11-2010 [eluser]LuckyFella73[/eluser] You want to check if a FILE was selected so you have to check the file array - for example: Code: <?php Only upload if user set a value - El Forum - 10-12-2010 [eluser]Corbee[/eluser] Thanks, $_FILES works. |