1

I need to upload a file from the visualforce page and sent the file data to the Apex controller class. From that class I need to sent that file data to my server(Using Apex HTTP Callouts). My questions are :

  • Is there a file size limit that can be uploaded from visualforce page to the Apex Controller?

  • Is it possible to sent the file data through RemoteAction call methods from the visualforce page? Because I need the Success/Failure response to process the page further

  • How to make the Apex HTTP Callouts for sending a file from salesforce? I am familar with normal Apex HTTP Callouts, but not with the multipart HTTP Callouts

1 Answer 1

0

According to VF documentation

  1. You can upload max 15 MB of attachment(standard SF attachment) via VF.(There is a catch read 3rd point)
  2. You can serialize the body and send it as string in Remote action and then create blob and make Callout
  3. The tricky part , Apex doesnt support MultiPart file upload, And the max size of Callout request you can make is 6MB(sync apex) .

https://developer.salesforce.com/docs/atlas.en-us.salesforce_app_limits_cheatsheet.meta/salesforce_app_limits_cheatsheet/salesforce_app_limits_platform_vf.htm

I would suggest you to directly upload file to your 3rd party server from VF's javascript.

2
  • Thanks for the response Pranay. To upload the file to the 3rd party server directly from the VF's javascript, In my case i need to append the secret key with the Http request call, which can't be passed to VF Page due to security reasons
    – Muthu
    Jan 19, 2017 at 12:21
  • I think multipart is still achievable when you set the header as req.setHeader('Content-Type', 'multipart/form-data; boundary="set your boundary value");
    – user28452
    Feb 6, 2019 at 4:43

You must log in to answer this question.

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