Upload large ContentVersion records

2018-06-24 16:19:18

I'm using a @RemoteAction to upload files to Salesforce, saving them as ContentVersion (Chatter files). I'm uploading the base64 Blob of the file.

This works great for small (<1MB) files.

I am NOT using lightning components for this. This is our Angular app calling a remote action with a file that the user uploaded.

Specifically the error I am getting is:

POST https://.visual.force.com/apexremote net:: ERR_CONNECTION_RESET

Visualforce Remoting Exception: Unable to connect to the server (communication failure).

From what I can tell, this is because of the HTTP POST size limit of 1MB.

Now, if you use the Salesforce-y method (directly uploading a file or embedding Chatter in a VF page) then you're good for 2GB.

How can I do that from my Angular app? Do I need to chunkify the blob myself? Is there a way for me to create a ContentVersion piecemeal?