Skip to main content

File Sharing

Better Messages allows users to share files, images, videos, and documents directly in conversations with support for resumable uploads, client-side media optimization, and file access protection.

How it works

Users can attach files to their messages using the attachment button in the message input area. Files can also be dragged and dropped directly onto the conversation. The plugin supports a wide range of file types including images, videos, documents, and archives. Uploaded files are stored in your WordPress media directory.

Before uploading, images and videos can be automatically optimized in the user's browser — reducing file sizes, converting to modern formats, and stripping metadata. This happens entirely on the client side using WebAssembly, so your server receives already-optimized files with no additional load.

For large files, the plugin supports resumable uploads using the TUS protocol, ensuring files can be uploaded reliably even on slow or unstable connections. If an upload is interrupted, it automatically resumes from where it left off.

File access protection is available through a proxy system that serves files through your WordPress server instead of exposing direct URLs. This prevents unauthorized users from accessing files by guessing or sharing direct download links.

Key capabilities

  • Share images, videos, documents, and other file types in messages
  • Drag-and-drop files directly onto conversations
  • Webcam photo capture directly in the message composer
  • Resumable uploads via TUS protocol for reliable large file transfers
  • Automatically convert images to modern formats (AVIF, WebP, or JPEG) in the browser before uploading
  • Convert MOV, AVI, WMV, and MKV videos to MP4 in the browser using FFmpeg WASM
  • Automatically convert iPhone HEIC photos to a compatible format
  • Remove EXIF data, GPS location, and camera info from images and videos to protect user privacy
  • Automatically downscale large images to a specified maximum dimension
  • File access protection through proxy serving (PHP, X-Sendfile, X-Accel-Redirect, LiteSpeed)
  • Configurable maximum file size and number of files per message
  • Whitelist of allowed file extensions
  • Optional auto-deletion of attachments after a specified number of days
  • Attachments browser tab in conversation details panel
  • Option to hide uploaded files from the WordPress Media Library

Image optimization

When enabled, images are converted to the best format supported by the user's browser before uploading. The conversion happens entirely in the browser using Web Workers and WebAssembly, so your server receives already-optimized files.

The format fallback chain is: AVIF → WebP → JPEG. The browser automatically uses the best format it supports — AVIF for modern browsers, WebP for older ones, and JPEG as a universal fallback.

Supported input formats: JPEG, PNG, BMP, TIFF, WebP, AVIF, HEIC/HEIF, and ICO. GIFs can optionally be transcoded to WebP, AVIF, or JPEG formats during upload using FFmpeg WASM. SVG files are not converted to preserve vector quality.

HEIC/HEIF photos from iPhones are always converted to JPEG regardless of whether image optimization is enabled, since browsers cannot display HEIC files natively. This uses the libheif WASM decoder.

You can also set a maximum image resolution to automatically downscale large images. The image is proportionally scaled so that neither width nor height exceeds the configured value. Set to 0 for no limit.

Video optimization

When enabled, videos in MOV, AVI, WMV, and MKV formats are converted to MP4 in the browser using the FFmpeg WASM engine before uploading. This provides cross-browser and cross-device compatibility.

The conversion first attempts a fast remux (container change without re-encoding) which completes almost instantly for compatible codecs like H.264. If remuxing fails, it falls back to a full transcode using H.264 video and AAC audio.

iPhone MOV files recorded with H.264 are typically remuxed instantly without any quality loss.

tip

The FFmpeg WASM engine is approximately 30MB and needs to be downloaded to your server first. Use the Download Engine button in the settings to install it.

Metadata stripping

When enabled, EXIF data, GPS coordinates, camera information, and other metadata are automatically removed from uploaded images and videos. This protects user privacy by preventing location and device information from being shared with other participants.

For images, metadata is stripped during the browser-side conversion process. If browser-side processing is unavailable, the server automatically strips metadata as a fallback using WordPress image editor (Imagick or GD).

For videos, metadata is stripped using FFmpeg's -map_metadata flag during video optimization.

Upload methods

Better Messages supports two upload methods:

  • Standard POST — Traditional file upload. Limited by your server's PHP upload_max_filesize and post_max_size settings.
  • TUS (Resumable Upload) — Files are uploaded in chunks and can resume after interruptions. Bypasses PHP upload size limits. Some hosting providers with aggressive WAF (Web Application Firewall) rules may block TUS uploads.

File access protection

When file proxy is enabled, all attachment URLs are routed through your WordPress server, which verifies the requesting user has access to the conversation before serving the file. Direct file URLs are blocked.

Available proxy methods:

  • PHP — Uses readfile() to serve files through PHP. Works everywhere but uses more memory and CPU.
  • X-Sendfile — For Apache with mod_xsendfile. PHP handles authentication, then Apache serves the file directly.
  • X-Accel-Redirect — For Nginx. PHP handles authentication, then Nginx serves the file directly. Requires an internal location block in your Nginx configuration.
  • LiteSpeed — For LiteSpeed web server. Uses X-LiteSpeed-Location header for efficient file serving.
tip

For best performance on high-traffic sites, use X-Sendfile (Apache), X-Accel-Redirect (Nginx), or LiteSpeed instead of the PHP method.

How to enable

Navigate to WP AdminBetter MessagesSettingsAttachments.

General settings

  • Enable File Sharing — Turn file attachments on or off
  • Hide from Media Library — Prevent uploaded files from appearing in WordPress Media (enabled by default)
  • Attachments Browser — Show an attachments tab in conversation details for browsing shared files
  • Webcam Photo — Allow users to capture photos from their webcam

Upload settings

  • Upload Method — Standard POST or TUS resumable uploads
  • Max File Size — Maximum file size in megabytes
  • Max Files Per Message — Maximum number of files per message (0 for unlimited)
  • Allowed Formats — List of permitted file extensions

Media optimization

  • Image Optimization — Convert images to the best browser-supported format (AVIF, WebP, or JPEG) before uploading
  • Image Quality — Quality level for converted images (1-100, default 85)
  • Max Image Resolution — Downscale images so neither dimension exceeds this value (0 for no limit)
  • Video Optimization — Convert videos (MOV, AVI, WMV, MKV) to MP4 in the browser before uploading
  • Strip Metadata — Remove EXIF, GPS, and camera data from images and videos (enabled by default)

File access protection

  • File Proxy — Serve files through a proxy to protect direct URLs
  • Proxy Method — Choose between PHP, X-Sendfile, X-Accel-Redirect, or LiteSpeed
  • Attachment Retention — Automatically delete attachments after N days (0 to keep forever)