shlogg · Early preview
Nurul Islam Rimon @nurulislamrimon

Increasing Upload Size Limits In Web Applications

Increase file upload size limits in Next.js (10mb), Express.js (50mb), Nginx (100M) and Apache (100M/120M). Configure in next.config.js, express.json(), .htaccess or php.ini.

When handling file uploads in a web application, the default upload size limit may be too small for large files. Here’s how you can increase it based on different technologies.

  
  
  1. Next.js (API Routes & Server Actions)

In Next.js, you can configure the upload size limit in next.config.js:

const nextConfig = {
  api: {
    bodyParser: {
      sizeLimit: "10mb", // Adjust this based on your needs
    },
  },
  experimental: {
    serverActions: {
      bodySizeLimit: "2mb", // Increase for server actions if needed
    },
  },
};
export default nextConfig;...