Skip to content

Commit

Permalink
Update file types and add note (vercel#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyphilemon authored Nov 19, 2024
1 parent 9dcdb7b commit fdd0ace
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/(chat)/api/files/upload/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ const FileSchema = z.object({
.refine((file) => file.size <= 5 * 1024 * 1024, {
message: 'File size should be less than 5MB',
})
.refine(
(file) =>
['image/jpeg', 'image/png', 'application/pdf'].includes(file.type),
{
message: 'File type should be JPEG, PNG, or PDF',
},
),
// Update the file type based on the kind of files you want to accept
.refine((file) => ['image/jpeg', 'image/png'].includes(file.type), {
message: 'File type should be JPEG or PNG',
}),
});

export async function POST(request: Request) {
Expand Down

0 comments on commit fdd0ace

Please sign in to comment.