Increase maximum upload file size to 50mb

This commit is contained in:
Sam Becker 2023-12-29 12:56:10 -05:00
parent c5c8f52c91
commit 8f98c4a7d1
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,9 @@
import { auth } from '@/auth';
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 { handleUpload, type HandleUploadBody } from '@vercel/blob/client';
import { NextResponse } from 'next/server';
@ -17,7 +20,7 @@ export async function POST(request: Request): Promise<NextResponse> {
if (session?.user) {
if (isUploadPathnameValid(pathname)) {
return {
maximumSizeInBytes: 40_000_000,
maximumSizeInBytes: MAX_PHOTO_UPLOAD_SIZE_IN_BYTES,
allowedContentTypes: ACCEPTED_PHOTO_FILE_TYPES,
};
} else {

View File

@ -18,6 +18,8 @@ export const ACCEPTED_PHOTO_FILE_TYPES = [
'image/jpeg',
];
export const MAX_PHOTO_UPLOAD_SIZE_IN_BYTES = 50_000_000;
// Core EXIF data
export interface PhotoExif {
aspectRatio: number