Add file overwriting

This commit is contained in:
2021-08-24 21:10:24 +02:00
parent f79485881d
commit 5a2d1fab43

View File

@@ -24,11 +24,14 @@ export default class FilesController {
}
await file.move(Application.makePath('storage'), {
name: `${label}.${file.extname}`
name: `${label}.${file.extname}`,
overwrite: true
})
return response.status(200).send({
file: await File.create({
file: await File.firstOrCreate({
label: label
}, {
fileName: `${label}.${file.extname}`,
label: label
})