fix: upload file

Deskripsi:
- fix api upload file pada project dan task

No Issues
This commit is contained in:
amel
2024-09-04 11:21:42 +08:00
parent 6bebd7dbfa
commit db5d9a2d81
4 changed files with 5 additions and 13 deletions

View File

@@ -152,10 +152,9 @@ export async function POST(request: Request) {
let fileFix: any[] = []
if (cekFile) {
let a = 0
const root = path.join(process.cwd(), "./public/file/task/");
for (var pair of body.entries()) {
if (String(pair[0]) == "file" + a) {
if (String(pair[0]).substring(0, 4) == "file") {
const file = body.get(pair[0]) as File
const fExt = file.name.split(".").pop()
const fName = file.name.replace("." + fExt, "")
@@ -190,7 +189,6 @@ export async function POST(request: Request) {
fileFix.push(dataFile)
}
a++
}
const insertFile = await prisma.divisionProjectFile.createMany({