How to upload a file of size 2GB from Apex? Is there any sobject that I can make use of?

2 Answers 2


The 'File Size Limits in Salesforce' help topic indicates that the following support 2GB.

  • Files Tab and Chatter
  • Salesforce CRM Content
  • Feed Attachments

That said, getting this size of data file in programatically reduces this to 10MB for Visualforce / Apex. Apex is going to be the limiting factor, especially with its heap size limits 6/12MB (depending async) and callout limits of 3MB. So your basically going to struggle with this size, the way the browsers do it is to stream it over rather than load it all into memory which is basically only option you have in Apex.

I even had a look at the Bulk API, but this has similar restrictions, this looks like a gap in Salesforce's API strategy to me. You might be able to get some way further by moving the processing to something like a Heroku service, which you could feasibly still invoke from a callout or a Canvas app perhaps.

enter image description here

  • I just want to upload a chatter file programatically. I use Connect API to post a comment along with an attachment. Once I upload a file using apex:inputfile, I want the BLOB content stored somewhere until I actually click on Post. I cannot have it in the memory since it will hit view state limits. So I want to store this in the database.
    – user5050
    Commented Jan 23, 2014 at 12:06
  • 1
    You can upload upto 10MB using apex:inputfile, just make sure its cleared out of the controller state before the page returns and you will avoid the view state issue. However this is a maximum of 10MB, as per the docs here, salesforce.com/us/developer/docs/pages/Content/… Commented Jan 23, 2014 at 12:09
  • Uploading a file and clicking on Post will happen at different times. So, I cant clear the state until the user clicks on Post.
    – user5050
    Commented Jan 23, 2014 at 12:14

You can't be able to upload that much size of file in salesforce , due to salesforce storage limit. In order to do so you need to use 3rd party storage server for saving the file.Also you need to use some server level language (such as java,.net,python etc)and make the handler class(for handling the request from salesforce) as a web hook for uploading the file to storage server and hit your request to that hook from salesforce (vf page) for uploading/downloading request. Cloud Drop is One such App that is some what following the same logic in order to store any number and size of files that can be associated with any salesforce object with Rackspace server. Please check the following link for more information:




Anchal Garg

You must log in to answer this question.

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