1

I have an LWC component that calls the React application. I uploaded files using Upload - Ant Design. I have a problem, I can upload a maximum of 4 mb. I upload files as FileReader.readAsDataURL() and pass them to salesforce as a string. Then I transform the string into BLOB and insert it into the attachment object. I need to find another way to upload 20 mb files. Does anyone have any ideas?

onChange(info: {
    file: { name?: any; status?: any; originFileObj?: any; uid: string }
    fileList: any
  }) {
    const { status } = info?.file ?? {}
    if (status !== DRAG_STATUSES.uploading) {
      log(info?.file, info?.fileList)
    }
    if (status === DRAG_STATUSES.done) {
      const reader = new FileReader()
      reader.addEventListener('loadend', (e) => {
        const data = e.target?.result
        console.log(data)
        uploadFoo(data, info.file.name, info.file.uid)
      })
      
      reader.readAsDataURL(info.file?.originFileObj)

      message.success(`${info?.file.name} file uploaded successfully.`)
    } else if (status === DRAG_STATUSES.error) {
      message.error(`${info?.file.name} file upload failed.`)
    }
   
  }
carl verbiest
  • 1,113
  • 1
  • 15
  • 30

0 Answers0