+ Start a Discussion
Ahmad Amiri 15Ahmad Amiri 15 

How to use progress text when uploading file with apex:inputFile and commandButton?

Hi,

I have a vf page form that has an inputfile tag for uploading a file, and I use commandButton with status and reRender to show  progress text while file loading and then display file's content.
It's working without rerender but when does not show waiting text and when I added <apex:actionRegion>  to my code doesnot pass parametesrs to apex class.

How can I have progress text with inputfile and commandButton to dislpay info from file at same page?

Thank you.

/Ahmad

below is my vf code snippet

<apex:commandButton value="Save" action="{!ReadFile}" status="theStatus" reRender="testblock"/>
        </apex:actionRegion>
     <apex:actionStatus id="theStatus">
                <apex:facet name="start">
                    <apex:outputPanel >
                        
                        Please wait...
                    </apex:outputPanel>
                </apex:facet>
    </apex:actionStatus>
      <apex:pageBlock id="testblock">
          <apex:pageBlockSection title="My Content Section" columns="2">   
           <apex:outputText >Namn:</apex:outputText>
                <apex:outputLabel value="{!nameFile}"/>
                   <apex:outputText >Namn1:</apex:outputText>
                <apex:outputLabel value="{!nameFile1}"/>
              <apex:outputText >Namn2:</apex:outputText>
                <apex:outputLabel value="{!nameFile2}"/>
            </apex:pageBlockSection>  

Apex:

 public void ReadFile()
    {
        
        if(nameFile == null)
            nameFile2 = 'File name is null ';
        else
            nameFile2 = 'Yohoooo ' + nameFile;
        
        if(contentFile == null)
            nameFile1 = ' content is null ';
        else
            nameFile1 = ' Yohoooo';
Best Answer chosen by Ahmad Amiri 15
logontokartiklogontokartik
The limitation with <apex:inputFile> is that you cannot use commandbuttons with reRender attribute and thats the reason why you are wrapping the button in actionRegion and when you wrap in actionRegion, you submit only the data thats inside the region to Controller.  Maybe you can try some other workaround like using JS instead.

Please see below if it helps
http://salesforce.stackexchange.com/questions/16635/apexinputfile-cannot-be-used-with-that-specifies-a-rerender-or-oncomplet/16636#16636

Also, you can use JS to show and hide the Progress text.