When a user uploads an image on my Visualforce page, it correctly adds or updates the document in a document folder in Salesforce. When the document is added or removed, if I refresh the page, the change is displayed immediately. However, if I just change the picture, the change does not take effect for a while... I assume this may be some caching issue with salesforce? But setting cache="false" on my page did not do anything.

Is there a way to reflect the changes of document bodies immediately? (When document is updated, everything but the MIME type and body are the same, including name). Or is my a valid option to delete that document and re-insert it when the user 'updates' the image instead of just trying to update the content of the document?

I am also grabbing the image url on load in a variable getter in my controller like: '/servlet/servlet.FileDownload?file=' + emailLogoDoc[0].Id;

I am not sure if there is some setting I can set to stop the caching so it grabs what is actually in the document on every reload/query, or if it is the way I am getting the image Url that is the problem.

1 Answer 1


I'm not 100% on this, but it seems to me you should be using URLFOR for this purpose instead of using hard-coded URLs:

<apex:image value="{!URLFOR($Action.Document.Download, logoDoc.Id)}" />

This presumes that the variable that holds the information is an object called logoDoc and the Id is Id; adjust these parameters as necessary. Using URLFOR should cause Salesforce to generate a URL that should refresh immediately the next time the page is rendered (i.e. immediately).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .