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

1 Answer 1

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.

3
  • So its not possible on the client side to show the previous selected files?
    – Thomas
    Commented Dec 11, 2018 at 20:03
  • @Thomas Correct. Sorry to disappoint, that's just how it is.
    – sfdcfox
    Commented Dec 11, 2018 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
    Commented Dec 11, 2018 at 21:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .