Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#8310 closed defect (bug) (fixed)

Wrong error messages while uploading

Reported by: sekundek Owned by: westi
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: Upload Keywords:
Focuses: Cc:


While dealing with random upload error i found that listed error messages were not set as it should. If you check the manual http://www.php.net/manual/en/features.file-upload.errors.php you can see that index error code 5 is missing. Because of that in my case wrong error was printed. On error code 6 message was "Failed to write file to disk" but the real error was "Missing a temporary folder". This needs to be corrected, because it missleads when error is printed to client. Error messages are listed in wp-admin/includes/file.php at row 234 and later at 340

It can be corrected with

$upload_error_strings = array( false,
                __( "The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
                __( "The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
                __( "The uploaded file was only partially uploaded." ),
                __( "No file was uploaded." ),
                __( "Missing a temporary folder." ),
                __( "Failed to write file to disk." ));

Problem with random upload was actually with XCache. When I disabled it error was gone.

Change History (2)

#1 @westi
12 years ago

  • Owner set to westi
  • Status changed from new to assigned

#2 @ryan
12 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [9930]) Fix upload error codes. Props sekundek. fixes #8310

Note: See TracTickets for help on using tickets.