+ Start a Discussion

apex:inputFile - cannot be used with ---- that specifies a rerender or oncomplete attribute ?

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

Is it because  POST is required to upload the file ?

Message Edited by devNut! on 11-18-2008 11:30 AM
Not a POST thing, a partial page update thing.

File inputs require a form that uses a multipart/form-data encoding type, and I think there are issues with the multipart/form-data encType on XHR requests.  (Note that this is not specific to Visualforce)

If you need to use partial page updates with your form there is a way around it by posting to a hidden iframe, but it's a bit of work.  Eventually we'd like to take care of this for you, but in the interest of getting inputFile into your hands we chose to release it with this limitation.

If you google for multipart enctype hidden iframe you might find some examples of how to solve this.  Otherwise you are stuck (for the time being) with using full page refreshes or redirects when using inputFile.
Also in case it's not clear, of course you can use a commandButton or commandLink to post your form.  But if you use a rerender attribute (the presence of a rerender attribute tells it to make an AJAX request instead of doing a regular post) it won't work without the iframe hack.
Jill, thanks for the information.


    We are struggling the using the inputfile tag respect to HTTPS class using multipart ,we are facing limitation issue we who are going to get some solution using multipart trafer of date using inputfile.


Wrap the actionFunction and the thing it rerenders within a single actionRegion.  I don't think this is documented, but it worked for me.



Hey jason,


Can you please give any example over here.. to wrap the action function.







Can you please share the sample code related to ActionRegion to upload multi attachments.

Maurizio BellaMaurizio Bella
as per my previous post, I've the same problem. Can you share your code, please? or someone can help me?
thanks for any suggest to fix my problem.
Maurizio BellaMaurizio Bella

someone can help me, please?

thanks for any suggest.

kind regards,



hey..did you solve that issue? I am trying to do a similar thing and would be great if you could share your solution


"Wrap the actionFunction and the thing it rerenders within a single actionRegion", that works for me too.


pseudo code:

   <apex:actionRegion >
        <apex:panelGrid columns="5" id="theGrid" columnClasses="ColCss">
            <apex:panelGroup rendered="{!shouldSelect}">
                <apex:outputText value="{!label}" />
            <apex:panelGroup rendered="{!shouldSelect}">
                <apex:image value="/s.gif" styleClass="upArrowIcon">
	            <apex:actionSupport event="onclick" action="{!upclick}" reRender="theGrid"/>
        <apex:inputFile value="{!document.body}" filename="{!document.name}"/>
        <apex:commandButton value="Upload" action="{!Upload}"/>