1

What I want to do is upload attachments for a record. For this, I was thinking of using javascript remoting and send attachments/files using remote action. Is there a limit for request data sent in remote action?

If you can suggest an approach for uploading multiple attachments through Visualforce page, please suggest.

Thanks in advance.

2

Using REST api is much better option than sending via remote action methods. Remote action methods have a limitation of number of character (1000000) that can be sent from a page to apex controller.Obviously when you convert a document to base64 encoded string there is always a chance that it will exceed the character limit.

To avoid this go for REST API, AFAIK it allows you to upload files upto the size of 37.5MB which should be go enough considering the limit on attaachment size is 25 MB. But the only downside is that this will consume APIs.

  • Thanks @Anamadeya, I think this is a good approach. Just saw the comment by Tushar Sharma on the question. What do you think about it? – ajinkyah Sep 7 '16 at 7:34
  • That is a complete Salesforce solution (no javascript needed) and that can also be used. Since you hinted that you are using remoting I assumed that you're building your page completely using JS, so I suggested the approach using REST API – Sam Sep 7 '16 at 8:23
  • I thought there will be some limitations with it that is why I was thinking of remoting approach. Any limitations you see with the no javascript solution in the blog? – ajinkyah Sep 7 '16 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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