Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

i am getting error

apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute.

but i cant skip using rerender or oncomplete. how can i solve this.

<apex:actionRegion > 
  <apex:outputPanel id="Panel"> 
    <apex:repeat value="{!wrapperValues}" var="w"> 
      <apex:inputfile value="{!w.document}"/> 
    </apex:repeat> 
  </apex:outputPanel> 
  <apex:commandbutton style="width: 170px;" value="Add another" action="{!addAnother}" reRender="Panel" /> 
</apex:actionRegion>
share|improve this question
    
can we use input type="file" instead of apex:inputfile –  Pankaj Feb 4 '13 at 9:55
    
Please post some code. Help me help you. :-) –  Peter Feb 4 '13 at 10:04
    
<apex:actionRegion > <apex:outputPanel id="Panel"> <apex:repeat value="{!wrapperValues}" var="w"> <apex:inputfile value="{!w.document}"/> </apex:repeat> </apex:outputPanel> <apex:commandbutton style="width: 170px;" value="Add another" > action="{!addAnother}" reRender="Panel" /> </apex:actionRegion> –  Pankaj Feb 4 '13 at 10:46
    
can we upload a file using html input type=file.if yes how we will bind it in backend –  Pankaj Feb 4 '13 at 10:58
    
I copied your code from your comment into the question and added formatting. –  Peter Feb 4 '13 at 16:29

2 Answers 2

As the error indicates, you simply can't do this. I'd imagine its a security feature, as the inputFile is allowing uploading of a file from the user's computer. You could use an iframe to contain the input file component, which means that other frames would be unaffected, but from the technical point of view it has to be a full refresh of the containing page.

share|improve this answer
    
hi bob.cant we use input type="file",HTML tag –  Pankaj Feb 4 '13 at 12:01
    
No, as this will be regular HTML form rather than a Visualforce form, so the file won't be bound to anything on the controller side. –  Bob Buzzard Feb 4 '13 at 12:49

You can put the inputfile component in a separate page and include the new page in your original page with an component.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.