pre_move_uploaded_file WordPress Filter Hook

The pre_move_uploaded_file hook is called before a file is uploaded to a WordPress site. It can be used to check the file for errors or to modify the file before it is uploaded.

apply_filters( 'pre_move_uploaded_file', mixed $move_new_file, array $file, string $new_file, string $type ) #

Filters whether to short-circuit moving the uploaded file after passing all checks.


Description

If a non-null value is returned from the filter, moving the file and any related error reporting will be completely skipped.


Top ↑

Parameters

$move_new_file

(mixed)If null (default) move the file after the upload.

$file

(array)Reference to a single element from $_FILES.

  • 'name'
    (string) The original name of the file on the client machine.
  • 'type'
    (string) The mime type of the file, if the browser provided this information.
  • 'tmp_name'
    (string) The temporary filename of the file in which the uploaded file was stored on the server.
  • 'size'
    (int) The size, in bytes, of the uploaded file.
  • 'error'
    (int) The error code associated with this file upload.

$new_file

(string)Filename of the newly-uploaded file.

$type

(string)Mime type of the newly-uploaded file.


Top ↑

Source

File: wp-admin/includes/file.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.