You need to sign in to do that
Don't have an account?
Suresh440
View Notes And Attachments in Visualforce Page
Hi All,
Iam trying to obtain or view the notes and Attachments Document of an object in a visualforce Page if the Notes&Attachment file is in Text format
Thanks In advance
You can query the Attachment Object and show the Body value as follows:
This works only for text files, you cannot get contents for other content types.
Sure you can output Blob data from Attachments. Try this:
http://help.salesforce.com/apex/HTViewSolution?id=000005941&language=en_US
and this:
http://boards.developerforce.com/t5/Visualforce-Development/Displaying-Image-attachments-in-VF-Page/td-p/153796
and this will give you some more ideas:
http://forceguru.blogspot.com/2011/06/display-picture-in-contact.html
Good luck!
Good morning,
thanks for your response, it was very helpful, but is there anyway to read audio files iin attachment,
I'm trying this:
<apex:page controller="ViewAudio" cache="true">
<audio controls="controls">
<source src="{!audio}" type="{!att.ContentType}" />
<embed src="{!audio}" />
</audio>
</apex:page>
and here is the controller code
public class ViewAudio {
public Attachment att {
get {
if (att == null) {
// the parent id is a place holder, i'm just testing it with a specified value
att = [SELECT Body, ContentType, Name FROM Attachment WHERE PARENTID = <parentid>];
}
return att;
}
private set;
}
public String audio {
get {
return EncodingUtil.Base64Encode(att.body);
}
}
}