Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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 '13 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. – Greg Grinberg Feb 8 '13 at 22:03
You can grab the file with javascript and then use the AJAX connector to insert it as an attachment. – Greg Grinberg Feb 8 '13 at 22:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.