1

I am trying to upload an image url from another domain with the Save to drive button of Google. So google tells me that I need to include the following special HTTP headers.

Access-Control-Allow-Origin: * Access-Control-Allow-Headers: Range Access-Control-Expose-Headers: Cache-Control, Content-Encoding, Content-Range Do some one know how I can include this headers in my project?

I get this information from https://developers.google.com/drive/web/savetodrive

Save to Drive Demo: Basic Page

3

1 Answer 1

0
<apex:page wizard="true">
<script src="https://apis.google.com/js/platform.js"></script>
    <center>
        <div class="g-savetodrive"
         data-src="/img/seasonLogos/2016_winter.png"
         data-filename="2015_winter_sales.gif"
         data-sitename="Salesforce 2015 Winter">
        </div>
    </center>
</apex:page>

Try with this code hope this will solve you.

As you can see I am using static image url for saving into google drive

you can make it dynamic. Give a try

If you need to pass the attachment image.

/servlet/servlet.FileDownload?file=00P9000000jhdTQ

Here pass your attachment id instead of 00P9000000jhdTQ and pass the url in data-src

data-src="your dynamic url"

Hope this will solve your problem

10
  • Your code is working fine and thanks for providing such information. but i want to add file from attachment (dynamically) this time it's throwing error which is described by me.
    – user9839
    Commented Dec 1, 2015 at 6:30
  • I will select both best answer if you help me.
    – user9839
    Commented Dec 1, 2015 at 6:30
  • @user9839 check my updated ans. you need to prepare dynamic url with attachment id and pass into data-src
    – Ratan Paul
    Commented Dec 1, 2015 at 6:37
  • I have do same as you like i have a image on below url c.ap1.content.force.com/servlet/… and then i have added this url on data-src="c.ap1.content.force.com/servlet/…" but it is not working.
    – user9839
    Commented Dec 1, 2015 at 6:44
  • Please Ratan help me , i am stuck on this problem from last three days.Thanks in advance
    – user9839
    Commented Dec 1, 2015 at 6:49

You must log in to answer this question.

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