Coder Social home page Coder Social logo

lwc-file-upload's Introduction

LWC drag & drop file uploader

Simple & easy to use drag and drog lightning web component

Features

  1. Supports file size up to 4.5 MB
  2. Uploads in chunks
  3. Supports overrides for basic UI text, custom apex controller, chunk size and maximum file size
  4. Support file upload into custom stores other then salesforce

UI

Image

How to use it

Put this in any LWC html file <c-file-upload parent-record-id={recordId}></c-file-upload>

Required parameters

  1. parent-record-id record id of the object where file has to uploaded into

Optional parameters

  1. title default is 'Upload'
  2. controller-name name of Custom Apex Controller that implements IFileUpload. If not this component will be uploaded as attachments into salesforce
  3. chunk-size default chunk size 750000 (750 kb)

Example Custom Apex Controller looks like this

public with sharing  class CustomFileUpload implements IFileUpload {
    
    /***
    @parentId - id of the sobject,
    @fileName - name of the file,
    @contentType - type of the file,
    @fileContent - content of the file,
    @fileId - if the upload is done in chunks, second request will contain the id of the first request response. first request will be always be '' or null
    @finalChunk - indicator of the last or final request if the upload is happening in batch/chunks
    @Id - output - file id of the source system that is unique to the file
    ***/
    public Id uploadFileInChunks(Id parentId, String fileName, String contentType, String fileContent, String fileId, Boolean finalChunk) {
        
        \\TODO 
        
    }

}

lwc-file-upload's People

Contributors

praneethjonna avatar praneethjonna10 avatar

Stargazers

Renchi Meléndez avatar Chayan Hazra avatar  avatar  avatar Tom Blume avatar  avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.