Files
ui/playground/server/api/blob.put.ts
2025-07-16 10:22:06 +02:00

13 lines
445 B
TypeScript

export default eventHandler(async (event) => {
return hubBlob().handleUpload(event, {
formKey: 'files', // read file or files form the `formKey` field of request body (body should be a `FormData` object)
multiple: true, // when `true`, the `formKey` field will be an array of `Blob` objects
ensure: {
types: ['image/jpeg', 'image/png'] // allowed types of the file
},
put: {
addRandomSuffix: true
}
})
})