fix ( upload image )
deskripsi: - perbaiki fungsi upload dan delete image di job
This commit is contained in:
@@ -3,18 +3,18 @@ import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
import sharp from "sharp";
|
||||
export async function POST(request: Request) {
|
||||
let fixFormData;
|
||||
const formData = await request.formData();
|
||||
const file: any = formData.get("file");
|
||||
const mimeType = file.type;
|
||||
console.log("MIME Type:", mimeType);
|
||||
|
||||
const valueOfDir = formData.get("dirId");
|
||||
const keyOfDirectory = await funGetDirectoryNameByValue({
|
||||
value: valueOfDir as string,
|
||||
});
|
||||
|
||||
if (request.method === "POST") {
|
||||
let fixFormData;
|
||||
const file: any = formData.get("file");
|
||||
const mimeType = file.type;
|
||||
// console.log("MIME Type:", mimeType);
|
||||
|
||||
try {
|
||||
if (mimeType != "application/pdf") {
|
||||
// Resize ukuran
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { DIRECTORY_ID, prisma } from "@/app/lib";
|
||||
import { NextResponse } from "next/server";
|
||||
import fs from "fs";
|
||||
import { funGlobal_DeleteFileById } from "@/app_modules/_global/fun";
|
||||
import { apiDeleteImageById } from "@/app_modules/_global/lib/api_image";
|
||||
import { prisma } from "@/app/lib";
|
||||
import backendLogger from "@/util/backendLogger";
|
||||
import { NextResponse } from "next/server";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
// GET ONE DATA PORTOFOLIO BY ID PORTOFOLIO
|
||||
|
||||
Reference in New Issue
Block a user