function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
devNut!devNut! 

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
jwetzlerjwetzler
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.
jwetzlerjwetzler
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.
devNut!devNut!
Jill, thanks for the information.
gv007gv007

Jill,

    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.

JasonGablerJasonGabler

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

 

vishalSharmavishalSharma

Hey jason,

 

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

 

Thanks,

Vishal

SFDC_LearnerSFDC_Learner

Hi,

 

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.
Regards,
Maurizio
Maurizio BellaMaurizio Bella

someone can help me, please?

thanks for any suggest.

kind regards,

Maurizio

yuviBWyuviBW

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

songlansonglan

"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>
            <apex:panelGroup rendered="{!shouldSelect}">
                <apex:image value="/s.gif" styleClass="upArrowIcon">
	            <apex:actionSupport event="onclick" action="{!upclick}" reRender="theGrid"/>
	        </apex:image>
            </apex:panelGroup>
        </apex:panelGrid>
   </apex:actionRegion>
   <div>
        <apex:inputFile value="{!document.body}" filename="{!document.name}"/>
        <apex:commandButton value="Upload" action="{!Upload}"/>
   </div>