CodeIgniter Forums
How to check if ‘userfile’ field is not empty before uploading a file? - 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: How to check if ‘userfile’ field is not empty before uploading a file? (/showthread.php?tid=4879)



How to check if ‘userfile’ field is not empty before uploading a file? - El Forum - 12-20-2007

[eluser]pulok[/eluser]
How can I check if user has selected any file to upload (before calling the $this->upload->do_upload() in my controller)? This is needed because there are other input fields along with a file upload field which is optional. Basically what I want to do is:
Code:
if ( user_chose_any_file_to_upload ){
   // try to upload file
   if ( ! $this->upload->do_upload()){
      blah.. blah.. blah..
   }
}



How to check if ‘userfile’ field is not empty before uploading a file? - El Forum - 12-20-2007

[eluser]ejangi[/eluser]
Deja vou - I could have sworn Michael Wales answered this here.


How to check if ‘userfile’ field is not empty before uploading a file? - El Forum - 12-21-2007

[eluser]pulok[/eluser]
Thanks @ucantblamem.
Oops, sorry, It was posted twice :-(