0

I have a simple apex repeat with add filename tag. When I add the following line "inputfile" the previous line shows no file chosen. Is it possible to bind the filename with the inputfile button with javascript?

Apex

<apex:repeat value="{!newAttachments}" var="newAtt">
                <apex:outputLabel value="Upload photo"/>                         
                <apex:inputFile id="inputfile" value="{!newAtt.body}" filename="{!newAtt.name}"/><br/>
            </apex:repeat><br/>
            <apex:commandButton value="Add More" action="{!addMore}"  onclick="checkFileSize(event);"/>

enter image description here

2

No. This is a security feature of the browser. The user must select/input the file name, and it is read-only from JavaScript's perspective.

  • So its not possible on the client side to show the previous selected files? – Thomas Dec 11 '18 at 20:03
  • @Thomas Correct. Sorry to disappoint, that's just how it is. – sfdcfox Dec 11 '18 at 20:08
  • @sfdcfoc That is a bummer. But I solved it by adding 5 upload options from the start so the files stay filled. Thanks for clarifying – Thomas Dec 11 '18 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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