PHP error guide

File was only partially uploaded: meaning and fix

Error summary

Ask the client to retry and never process the incomplete temporary file. PHP receives only part of a multipart upload and sets UPLOAD_ERR_PARTIAL.

What it means

Ask the client to retry and never process the incomplete temporary file. PHP receives only part of a multipart upload and sets UPLOAD_ERR_PARTIAL.

What the error means

This message means that PHP receives only part of a multipart upload and sets UPLOAD_ERR_PARTIAL. The exact signature distinguishes file was only partially uploaded from a generic application failure.

Why PHP produces it

The engine or service reports “File was only partially uploaded” because its required precondition was not met. Ask the client to retry and never process the incomplete temporary file.

PHP version notes

The file was only partially uploaded wording here is based on PHP 7.x–8.4; punctuation and exception class names can differ on older branches or vendor builds.

Most common causes

  • The immediate input or configuration reaches the specific condition: PHP receives only part of a multipart upload and sets UPLOAD_ERR_PARTIAL
  • The code path assumes the prerequisite for file was only partially uploaded has already been satisfied.
  • For file was only partially uploaded, development and production differ in version, extension, permissions, paths, or service configuration.
  • An earlier operation returned an unchecked value that is consumed by the line reporting file was only partially uploaded.

Minimal examples

BAD — reproduces the problem

php
move_uploaded_file($_FILES["doc"]["tmp_name"], $dest);

FIXED — safer pattern

php
if ($_FILES["doc"]["error"] !== UPLOAD_ERR_OK) { throw new RuntimeException("Upload failed"); }

Step-by-step diagnosis

  1. Copy the complete “The uploaded file was only partially uploaded” text and retain the first application stack frame.
  2. Reproduce file was only partially uploaded in the same SAPI and environment listed for this page.
  3. Before changing file was only partially uploaded, inspect the preceding value or directive and verify its type, path, version, and permissions.
  4. Apply the narrow correction—ask the client to retry and never process the incomplete temporary file—then repeat the original request once.

Fixes

Correct the failing prerequisite

Ask the client to retry and never process the incomplete temporary file

php
if ($_FILES["doc"]["error"] !== UPLOAD_ERR_OK) { throw new RuntimeException("Upload failed"); }

Fail explicitly at the boundary

Validate the condition before the operation that emits file was only partially uploaded, and log a safe diagnostic without credentials or full production paths.

Common mistakes when fixing it

  • Suppressing file was only partially uploaded instead of correcting its upstream condition.
  • Testing file was only partially uploaded only with the CLI binary when the failing request runs under FPM or Apache.
  • Changing a global setting for file was only partially uploaded before confirming the site-specific effective configuration.

How to prevent it

  • Add a focused test that exercises the boundary responsible for file was only partially uploaded.
  • Keep runtime versions, extensions, configuration, and deploy artifacts affecting file was only partially uploaded reproducible.
  • Validate external data and service return values before they can trigger file was only partially uploaded.

Web server / environment notes

fpm, apache, linux, shared-hosting. The failure occurs where pHP receives only part of a multipart upload and sets UPLOAD_ERR_PARTIAL

Tags: fpm,apache,linux,shared-hosting

Categories