Right now I'm limited by the 3mb heap restriction. Since an httprequest cannot be chunked when requesting a file be downloaded is there another way?

1 Answer 1


The limit you are running into is not the heapsize limit but the "Maximum size of callout request or response" which is always 3mb.

There is no way to get around this in apex but you could download the file with client-side javascript on a visualforce page and then use the AJAX Connector to insert the file to avoid this limitation.

  • I think it's directly repeated to the heap. I don't want to download the file to the client. I want to download/import into salesforce from a URL.
    – fourq
    Feb 8, 2013 at 21:35
  • Yes, it is added to the heap but the heap limit is actually 6mb (except for @future and email services where it is higher) whereas the callout request/reponse limit is 3mb so that is the one you will hit first. Feb 8, 2013 at 22:03
  • 1
    You can grab the file with javascript and then use the AJAX connector to insert it as an attachment. Feb 8, 2013 at 22:08

You must log in to answer this question.

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