I have a Visualforce page to upload the files to content and another Visualforce page with the list of items that got uploaded and list of items to upload the page. Now I need to add upload functionality against second page, i.e items to upload page.
I have added column to upload file against each item. Any one done this? Please help me with sample code
Best Answer
The best way (not easy for all) to do this use JS Remoting (Javascript remoting). It prevents from hitting Salesforce governor limit. But you should be aware that you cannot upload file which exceed the limit for object. If you are not familiar with JS remoting view these examples first before proceed.
Ex: to use js remoting:
MultiuploadHandler
is the name of class anduploadAttachment
is static method (JS remoting can work with static methods only and can return String) . This function passes 3 parameters (for method in apex code) +function to show status
.Method in apex code this is for attachment you can change it for content document with little effort:
This example upload a attachment in orgnisation for selected record. Try to implement with documents.