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
Sumant KuchipudiSumant Kuchipudi 

How can we show image after uploading from javascript?

Hi,
I have a page with three upload files, I have used JavaScript remoting to upload them to Attachment. I need to show those images on pase as soon as I stored them but not able to display, i tried the following scenarios but no use. 

1) 
var img = document.createElement("img");
img.src = "/servlet/servlet.FileDownload?file="+attachmentId;
document.getElementById('photoIcon').appendChild(img);


<div id="photoIcon" />

2:
var imageicon = "/servlet/servlet.FileDownload?file="+attachmentId;
/document.getElementById('photoIcon').src = imageicon;


<img id="photoIcon" />
3.
//document.getElementById("photoIcon").innerHTML="<img src='/servlet/servlet.FileDownload?file='"+attachmentId+" />";
document.getElementById("photoIcon").innerHTML='<img src=="{!URLFOR($Action.Attachment.Download, '00P1D000000OiF0UAK')}"/>';
But no use.. is it possible to display them after we save attachment from Remoting?
Please Advice.

Thanks