Hello, i'm trying to upload files on my nextjs 14.0.4 app with fastify/busboy, however, while the files upload in the right repo, with the right name and right extension, they are unsuable "Not a JPEG file: starts with 0xef 0xbf", exemple with an jpeg file. I double checked the files are fine. It's my first nextjs app, any help would be greatly aprreciated. Thanks for your time.
Ps : sorry for the previous version, i sent the wrong code.
import { PrismaClient } from '@prisma/client';
const Busboy = require('busboy');
import fs from 'fs';
//import path from 'path';
} catch (error) {
console.error('Erreur lors de la création de la ressource:', error);
res.status(500).json({
success: false,
message: 'Erreur lors de la création de la ressource',
});
} finally {
await prisma.$disconnect();
}
};
My Environment :
node version: v20.11.0
os: Linux
Nextjs 14.0.4, prisma.
Hello, i'm trying to upload files on my nextjs 14.0.4 app with fastify/busboy, however, while the files upload in the right repo, with the right name and right extension, they are unsuable "Not a JPEG file: starts with 0xef 0xbf", exemple with an jpeg file. I double checked the files are fine. It's my first nextjs app, any help would be greatly aprreciated. Thanks for your time.
Ps : sorry for the previous version, i sent the wrong code.
import { PrismaClient } from '@prisma/client'; const Busboy = require('busboy'); import fs from 'fs'; //import path from 'path';
const prisma = new PrismaClient();
export const createRessource = async (req, res) => { try { let bb = Busboy({ headers: req.headers, limits: { fileSize: 3000000 }, highWaterMark: undefined, removeContentLengthHeader: true, removeBodyParsers: true, });
} catch (error) { console.error('Erreur lors de la création de la ressource:', error); res.status(500).json({ success: false, message: 'Erreur lors de la création de la ressource', }); } finally { await prisma.$disconnect(); } }; My Environment :