0

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

http://sfdcmonkey.com/2017/09/25/file-upload-lightning-component/

0

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:component>
    <aura:attribute name="myRecordId" type="String" description="Record to which the files should be attached" />
    <lightning:fileUpload label="Attach receipt"
        name="fileUploader"
        multiple="true"
        accept=".pdf, .png"
        recordId="{!v.myRecordId}"
        onuploadfinished="{!c.handleUploadFinished}" />
</aura:component

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.