Automatically shows the Choose file Option / Button when a checkbox is selected.

whenever I select/check the checkbox (checkbox value=true) then the ChooseFile (inputfile) should display/show automatically .

Vf code:

<apex:page controller="example23">

<apex:form >

 <apex:inputCheckbox value="{!option}" >
<apex:actionsupport event="onclick" action="{!change}" />

<apex:actionRegion rendered="{!bool}">

<apex:inputFile value="AttachFile" />



Apex Controller:

public class example23 {

 public Boolean bool { get; set; }
 public Boolean option { get; set; }
 public PageReference change() {
 if(option == true)
 bool = true; 
 bool = false; 
 return null;

public example23(){
bool =false;


To hide  tag