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
downloadingdownloading 

View the Uploaded content

HI ,  

 I have Uploaded   a file using vf apex code, 

now I wanna view the content or display the content say in a different page, 

So how couldi achieve this..Pls Anyone send me the sample code

 

 

ThankYou

Navatar_DbSupNavatar_DbSup

Hi,

 

Use the below code as reference

 

 

______ Vf page ________________
<apex:page controller="displayimage" >
<apex:image url="/servlet/servlet.FileDownload?file={!imageid}" width="50" height="50" />
</apex:page>

_____________Controller____________________
public class displayimage
{
public string imageid{get;set;}
public displayimage()
{
imageid=ApexPages.currentPage().getParameters().get('Id');
}
}

 

Pass the uploaded file id in the url .

For example call the function on the button click on the upload file image

 

public PageReference displayimage()
{
PageReference pageRef= new PageReference('/apex/pagename?id='+doc.id);
pageRef.setredirect(true);
return pageRef;
}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.