diff --git a/app/Controllers/Http/FilesController.ts b/app/Controllers/Http/FilesController.ts index 2bb89a1..e9de178 100755 --- a/app/Controllers/Http/FilesController.ts +++ b/app/Controllers/Http/FilesController.ts @@ -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 })