Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

25 lines
627 B

<script>
import { Dropzone } from "@budibase/bbui"
import { uploadAttachment } from "@budibase/component-sdk"
const BYTES_IN_MB = 1000000
export let files = []
function handleFileTooLarge(fileSizeLimit) {
alert(
`Files cannot exceed ${fileSizeLimit /
BYTES_IN_MB}MB. Please try again with smaller files.`
)
}
async function processFiles(fileList) {
let data = new FormData()
for (let i = 0; i < fileList.length; i++) {
data.append("file", fileList[i])
}
return await uploadAttachment(data)
}
</script>
<Dropzone bind:files {processFiles} {handleFileTooLarge} />