Contents
How to upload a file as an attachment in Visualforce?
To Upload file as an attachment or as a file using Visualforce,one must have Record Id so that the Uploaded file links with that Record. In Order to use Bootstrap, JQuery or CSS for Designing purpose you can refer to the following link to access Script files
How to upload a file as an attachment to a record?
This example illustrates the way to upload a file and attach it against any record using Visualforce. The file that you upload using this will be available in the “Notes & Attachments” related list for the record. Click here if you are looking to upload a file into “Documents”. Step 1: Create an Apex class named “attachmentsample” .
How to insert a file as a Salesforce file?
In Order to Insert file as Salesforce File, first of all we need to make the Lookup field for particular Object with related list in which we want to insert file in Content Version. Please refer to the steps I have performed “I have created 2 Lookup fields in Lead and Account Objects”.
How to upload a CSS script in Salesforce?
In Order to use Bootstrap, JQuery or CSS for Designing purpose you can refer to the following link to access Script files Upload this Zip file as a static Resource in your Salesforce Org and use it in Visualforce Component.
How to use apex input and output in Visualforce?
Now Use this Component in your Visualforce Page and use some Apex Input and Output Tags. to get File title and to get File Description as Input from User . for choose attachment file. to Save Attachment . Jquery function to show to name of file.
How to insert a file as an attachment?
In order to Insert file as an Attachment Related to Record Just make the instance of Attachment Object and put the Values Like File Title, File Description, Body, Related Record Id.
Can you use apex inputfile with action component?
But I get an error saying – apex:inputFile can not be used in conjunction with an action component, apex:commandButton or apex:commandLink that specifies a rerender or oncomplete attribute. I am doing this on a sample custom object that i created – test_Object2__c