Welcome Guest, Not a member yet? Register   Sign In
Is file selected checking
#1

(This post was last modified: 03-14-2015, 11:37 PM by rejoan.)

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

(This post was last modified: 03-15-2015, 07:52 AM by spjonez.)

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




Theme © iAndrew 2016 - Forum software by © MyBB