mirror of
https://github.com/ArthurDanjou/artdanj-api.git
synced 2026-01-28 02:20:27 +01:00
Add file overwriting
This commit is contained in:
@@ -24,11 +24,14 @@ export default class FilesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await file.move(Application.makePath('storage'), {
|
await file.move(Application.makePath('storage'), {
|
||||||
name: `${label}.${file.extname}`
|
name: `${label}.${file.extname}`,
|
||||||
|
overwrite: true
|
||||||
})
|
})
|
||||||
|
|
||||||
return response.status(200).send({
|
return response.status(200).send({
|
||||||
file: await File.create({
|
file: await File.firstOrCreate({
|
||||||
|
label: label
|
||||||
|
}, {
|
||||||
fileName: `${label}.${file.extname}`,
|
fileName: `${label}.${file.extname}`,
|
||||||
label: label
|
label: label
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user