
3 answers

Hi Suchawalee,What you are doing is trying to access 0 index of an empty List which is giving you IndexOutOfBoundException.Change the line,fileId[i] = attachedFiles[i].Id;withfieldId.add(attachedFiles[i].Id);Example :
Also on page you must iterate the list,List<String> li = new List<String>();
System.debug(li.isEmpty()); // true
Hope it helps!<apex:page standardController="Account" extensions="displayImageExtension">
<apex:form >
<apex:repeat value="{!FileId}" var="v">
<apex:image url="/servlet/servlet.FileDownload?file={!v}"/>
</apex:repeat>
</apex:form>
</apex:page>