+ Start a Discussion
Marco MancillaMarco Mancilla 

How to upload an image and store its URL in a field on a record

Hello,

I want to add a button to my Product2 object that lets a user upload a photo of the product. I would like the image URL be stored automatically in a field on the Product2 record after uploading. I am guessing that to achieve this, I need to make some kind of visualforce widget for uploading the image, tie that to the action of a button on the object, and then have some kind of workflow rule or apex trigger fire after the image is uploaded and enter its URL into the field. What is the easiest way to do this?
Gaurav Jain 7Gaurav Jain 7
Hi Macro,

You can use Text Area (Rich text).
The maximum size of an image that can be uploaded in a rich text area field is 1 MB. Only .gif, .jpg, and .png file types are supported.
Images within the rich text area fields count towards file storage for the object that contains the field.

Help docs seem to answer all your questions:
https://help.salesforce.com/HTViewHelpDoc?id=fields_using_rich_text_area.htm

Mark it as Best Answer, if it helps
 
Marco MancillaMarco Mancilla
I do not want to store the file in a rich text field. I want the file stored in the documents object and want a PATH (not the image itself, just the URL) to that file stored in a PLAIN TEXT URL field. I already have a separate page that is rendering the images based on that path. I do not need rich text.