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
DennisSDennisS 

How to upload, save, and display image on Visualforce page?

Hi All,

 

I'm developing application on force.com platform and I need to do the following:

 

1) upload image using Visualforce page

2) save uploaded image to the force.com database 

3) retrieve saved image from the database and display it on another Visualforce page 

 

For step 1 I can use <apex:inputFile ../> component to get an Apex blob object representing uploaded image.

However, for step 2 I don't know how to save this object to force.com database as it doesn't support blob fields.

For step 3 I assume I can use <apex:image .. /> component to display the image.

 

Could anyone advice if I'm on the right track or what is the right way to do this kind of things on Force.com platform?

 

Thanks in advance,

Dennis 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can save the image as a Document or as an Attachment to another object.    It depends if this is associated with another object or is standalone.

 

 

 

 

All Answers

bob_buzzardbob_buzzard

You can save the image as a Document or as an Attachment to another object.    It depends if this is associated with another object or is standalone.

 

 

 

 

This was selected as the best answer
DennisSDennisS

Thank you, Bob.

 

Attachments worked great for me.

 

Regards,

Dennis 

Message Edited by DennisS on 01-01-2010 03:12 PM
bcgbcg

Hello,

 

I also need the same thing. will you pls share your code or gave me some suggestion for the same.

 

Thanks In Advance

vpmvpm
Hi,
Can you tell what to do for 3rd steps ?