i Am inserting single record with single file but how i can insert single record with multiple file in single transaction using lightning aura component.please let me know. please refer this link



Though you have not mentioned what you have tried so far, Aura framework provides you a base component which you can use to upload multiple files at a time related to a record.

A lightning:fileUpload component provides an easy and integrated way for users to upload multiple files. The file uploader includes drag-and-drop functionality and filtering by file types.

File uploads are always associated to a record, hence the recordId attribute is required. Uploaded files are available in Files Home under the Owned by Me filter and on the record's Attachments related list on the record detail page. Although all file formats that are supported by Salesforce are allowed, you can restrict the file formats using the accept attribute.

This example creates a file uploader that allows multiple PDF and PNG files to be uploaded. Change the recordId value to your own.

    <aura:attribute name="myRecordId" type="String" description="Record to which the files should be attached" />
    <lightning:fileUpload label="Attach receipt"
        accept=".pdf, .png"
        onuploadfinished="{!c.handleUploadFinished}" />

You must handle the onuploadfinished event, which is fired when the upload is finished.

    handleUploadFinished: function (cmp, event) {
        // Get the list of uploaded files
        var uploadedFiles = event.getParam("files");
        alert("Files uploaded : " + uploadedFiles.length);

Read more here:- lightning:fileUpload

  • I am using lightning:input.i am inserting record and attachment at a single transaction usnig lightning component.but when i am using file upload it is disabled mode in lightning component. – venkatesh Jun 10 at 12:30
  • Please update your question with what you are trying to do by editing it. – sanket kumar Jun 10 at 12:33

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.