0

Trying to upload files upto 20 MB from Salesforce Visualforce page to another server. But when I select a file using apex:inputFile , it says file limit is 10 MB. Any idea about this ?

Already tried with transient variable

Amit Sahu
  • 26
  • 5

1 Answers1

0

Normal apex code has 6 MB heap (memory) size limit. Asynchronous apex (batch jobs, @future methods) have 12 and custom-coded inbound email handlers have 36. You won't be able to push more than that from server-side code. Even less if the file is binary and you might have to base64-encode it before sending.

Send email with attachments? Send from JavaScript instead of apex? Or change the direction, make the other system login to SF and retrieve files (up to 2 GB). Either make the other system check every hour or send them some notification msg that there are new files to pick up. Maybe even a Platform Event?

Or check if you can make a web mashup, display page from that 3rd party app in iframe for example.

https://help.salesforce.com/articleView?id=000321537&language=en_US&type=1&mode=1

https://trailhead.salesforce.com/en/content/learn/projects/workshop-platform-events/platform-event-define

eyescream
  • 18,088
  • 2
  • 34
  • 46
  • Thanks @eyescream for your response! I had hit these limits already and all the documents say the same thing, from service side this is the limits. And yes, after converting a 2 MB file to Base64 it blows the heapsize :) due to the fact that the converting increases the file size. I was able to upload files upto 2 GB to the Files. But the requirement here is to upload the file directly to another server. – Amit Sahu Sep 12 '19 at 15:00
  • Go asynchronous (@future, Queueable etc), pass the 5 MB file as param or save it in VF and then query it by id. Base64 adds 33% overhead so in future method you end up with 11.7 MB used out of 12 MB max. Sorry I don't have better answer for you. – eyescream Sep 12 '19 at 15:06
  • thanks, will check and update if I have anything better on this! – Amit Sahu Sep 12 '19 at 15:08