Attachment upload failures in XenForo—commonly appearing as generic upload error overlays, HTTP 413 Request Entity Too Large responses, or broken image thumbnails—occur when size and memory thresholds are mismatched across your software stack. Resolving these errors requires aligning limits across XenForo's AdminCP, PHP, your web server, and ImageMagick.
Aligning XenForo Attachment Options and PHP Limits
Start by checking your application-level ceiling under AdminCP > Setup > Options > Attachments and adjusting Maximum attachment file size (KB) to match your community's needs. However, PHP will silently reject any file that exceeds its own runtime directives regardless of your AdminCP setting.
Open your active php.ini file and configure the upload directives using a strict size hierarchy where memory_limit is larger than post_max_size, and post_max_size is larger than upload_max_filesize to account for multipart form overhead:
After saving php.ini, reload your PHP worker pool via SSH (for example, systemctl restart php8.3-fpm) and confirm the updated values under AdminCP > Tools > PHP info.
Resolving HTTP 413 Errors in Nginx and Apache
If large uploads fail immediately before PHP executes, your web server is dropping the request body. By default, Nginx enforces a strict 1MB maximum request size and returns an HTTP 413 error to XenForo's uploader script. Open your site's Nginx virtual host configuration and add client_max_body_size inside the server block:
Reload Nginx with nginx -t && systemctl reload nginx to apply the change. Note that if your domain is proxied through Cloudflare on a Free or Pro plan, Cloudflare enforces a hard 100MB maximum upload size per HTTP request at the edge.
Preventing Thumbnail Crashes with ImageMagick Memory Policies
High-resolution smartphone photos (such as 48MP or 108MP images) decompress into massive raw pixel arrays during thumbnail generation, frequently exhausting PHP's memory allocation when using the default PHP built-in GD image library. To offload image processing outside PHP's memory limit:
Aligning XenForo Attachment Options and PHP Limits
Start by checking your application-level ceiling under AdminCP > Setup > Options > Attachments and adjusting Maximum attachment file size (KB) to match your community's needs. However, PHP will silently reject any file that exceeds its own runtime directives regardless of your AdminCP setting.
Open your active php.ini file and configure the upload directives using a strict size hierarchy where memory_limit is larger than post_max_size, and post_max_size is larger than upload_max_filesize to account for multipart form overhead:
Kod:
upload_max_filesize = 64M
post_max_size = 72M
memory_limit = 256M
max_execution_time = 120Resolving HTTP 413 Errors in Nginx and Apache
If large uploads fail immediately before PHP executes, your web server is dropping the request body. By default, Nginx enforces a strict 1MB maximum request size and returns an HTTP 413 error to XenForo's uploader script. Open your site's Nginx virtual host configuration and add client_max_body_size inside the server block:
Kod:
server {
listen 443 ssl http2;
server_name yourdomain.com;
client_max_body_size 72M;
...
}Preventing Thumbnail Crashes with ImageMagick Memory Policies
High-resolution smartphone photos (such as 48MP or 108MP images) decompress into massive raw pixel arrays during thumbnail generation, frequently exhausting PHP's memory allocation when using the default PHP built-in GD image library. To offload image processing outside PHP's memory limit:
- Navigate to AdminCP > Setup > Options > Attachments and switch Default image processor to ImageMagick PECL extension (if installed on your host).
- Set Maximum attachment image dimensions (for example, 3840 x 2160 pixels) so XenForo downscales oversized raw images automatically upon upload.
- If large image uploads still stall during thumbnail creation, open /etc/ImageMagick-6/policy.xml (or ImageMagick-7) via SSH and increase the memory, map, and disk resource policy values from their restrictive defaults (such as raising memory to 512MiB and disk to 2GiB).