Increase maximum upload file size to 50mb
This commit is contained in:
parent
c5c8f52c91
commit
8f98c4a7d1
@ -1,6 +1,9 @@
|
|||||||
import { auth } from '@/auth';
|
import { auth } from '@/auth';
|
||||||
import { revalidateAdminPaths, revalidatePhotosKey } from '@/cache';
|
import { revalidateAdminPaths, revalidatePhotosKey } from '@/cache';
|
||||||
import { ACCEPTED_PHOTO_FILE_TYPES } from '@/photo';
|
import {
|
||||||
|
ACCEPTED_PHOTO_FILE_TYPES,
|
||||||
|
MAX_PHOTO_UPLOAD_SIZE_IN_BYTES,
|
||||||
|
} from '@/photo';
|
||||||
import { isUploadPathnameValid } from '@/services/blob';
|
import { isUploadPathnameValid } from '@/services/blob';
|
||||||
import { handleUpload, type HandleUploadBody } from '@vercel/blob/client';
|
import { handleUpload, type HandleUploadBody } from '@vercel/blob/client';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
@ -17,7 +20,7 @@ export async function POST(request: Request): Promise<NextResponse> {
|
|||||||
if (session?.user) {
|
if (session?.user) {
|
||||||
if (isUploadPathnameValid(pathname)) {
|
if (isUploadPathnameValid(pathname)) {
|
||||||
return {
|
return {
|
||||||
maximumSizeInBytes: 40_000_000,
|
maximumSizeInBytes: MAX_PHOTO_UPLOAD_SIZE_IN_BYTES,
|
||||||
allowedContentTypes: ACCEPTED_PHOTO_FILE_TYPES,
|
allowedContentTypes: ACCEPTED_PHOTO_FILE_TYPES,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -18,6 +18,8 @@ export const ACCEPTED_PHOTO_FILE_TYPES = [
|
|||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const MAX_PHOTO_UPLOAD_SIZE_IN_BYTES = 50_000_000;
|
||||||
|
|
||||||
// Core EXIF data
|
// Core EXIF data
|
||||||
export interface PhotoExif {
|
export interface PhotoExif {
|
||||||
aspectRatio: number
|
aspectRatio: number
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user