• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Is file selected checking

#1
Hi,
Is there any way to check is user browse file for upload or not? currently I am doing with this
PHP Code:
if($_FILES && $_FILES['avatar']['name']){...} 

Shouldn't there is a codeigniter way to do this? this is need because when user will select file for upload then validation operation will work. i.e file upload option is optional
The largest Bengali tutorial site on Web Development in this planet
Reply

#2
There is, the do_upload method on the upload class.

Code:
...
$this->upload->initialize( $config );

if ( $this->upload->do_upload( ) === true ) {
    $file = $this->upload->data( );
}
else {
    // file was not uploaded, errors are in $this->upload->display_errors( )
}
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.