upd: nama file saat upload di semua fitur mobile
This commit is contained in:
@@ -60,9 +60,9 @@ export async function POST(request: Request) {
|
||||
for (var pair of body.entries()) {
|
||||
if (String(pair[0]).substring(0, 4) == "file") {
|
||||
const file = body.get(pair[0]) as File
|
||||
const fileName = file.name
|
||||
const fileName = decodeURIComponent(file.name)
|
||||
const fExt = file.name.split(".").pop()
|
||||
let fName = file.name.replace("." + fExt, "")
|
||||
let fName = fileName.replace("." + fExt, "")
|
||||
const cek = dataOmit.some((i: any) => i.file == fileName)
|
||||
if (cek) {
|
||||
const random = Math.floor(Math.random() * 1000)
|
||||
|
||||
@@ -77,7 +77,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
|
||||
const file = body.get("file") as File
|
||||
const fileName = file.name
|
||||
const fileName = decodeURIComponent(file.name)
|
||||
|
||||
const dataCek = await prisma.project.count({
|
||||
where: {
|
||||
|
||||
@@ -227,7 +227,7 @@ export async function POST(request: Request) {
|
||||
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, "")
|
||||
const fName = decodeURIComponent(file.name.replace("." + fExt, ""))
|
||||
const upload = await funUploadFile({ file: file, dirId: DIR.project })
|
||||
if (upload.success) {
|
||||
await prisma.projectFile.create({
|
||||
|
||||
@@ -173,7 +173,7 @@ export async function PUT(request: Request, context: { params: { id: string } })
|
||||
}
|
||||
|
||||
const file = body.get("file") as File
|
||||
const fileName = file.name
|
||||
const fileName = decodeURIComponent(file.name)
|
||||
|
||||
const dataCek = await prisma.divisionProject.count({
|
||||
where: {
|
||||
|
||||
Reference in New Issue
Block a user