You need to sign in to do that
Don't have an account?
How to view a file and save to local machine
Hi All,
i have saved a file to some third party sever. I am making an APi call retriving the file and below is the response
HTTP/1.1 200 Ok
Date: Wed, 11 Jul 2007 19:37:41 GMT
Server: Apache
Last-Modified: Fri, 12 Jun 2007 13:40:18 GMT
ETag: b0dffe8254d152d8fd28f3c5e0404a10
Content-type: text/html
Content-Length: 512000
[ ... ] (file content)
Now i need to create a link (view ) in vf page, so when a user click this link he should be able to download the file(same view functionality in document or we can say save as functionality).
Please let me know, Do i need to bulid the file again or Is there quick java script where i can pass all these values and it will take care rest.
Thanks in Advance!!
You can use following javascript to download a file :
<body>
<script>
function downloadme(x)
{
myTempWindow = window.open(x,'','left=10000,screenX=10000');
myTempWindow.document.execCommand('SaveAs','null','download.pdf');
myTempWindow.close();
}
</script>
<a href=javascript:downloadme('/test.pdf');>Download this pdf</a>
</body>
Hope this helps.
Thanks Pradeep , But i dont have file path, i am getting response as a file content in response body.
Do i need to rebulid or file or any other way i can directly pass response to browser
Hi,
I am facing exactly same issue.
Did you find any solution for it?
Thanks in advance.