my $fh = $query->upload('upload_file'); if ( defined $fh ) { # do your stuff }