WP_REST_Attachments_Controller::get_filename_from_disposition

SummerySummery

Parses filename from a Content-Disposition header value.

Syntax

WP_REST_Attachments_Controller::get_filename_from_disposition( string[] $disposition_header )

DescriptionDescription

As per RFC6266:

content-disposition = "Content-Disposition" ":"
                       disposition-type *( ";" disposition-parm )

disposition-type    = "inline" | "attachment" | disp-ext-type
                    ; case-insensitive
disp-ext-type       = token

disposition-parm    = filename-parm | disp-ext-parm

filename-parm       = "filename" "=" value
                    | "filename*" "=" ext-value

disp-ext-parm       = token "=" value
                    | ext-token "=" ext-value
ext-token           = <the characters in token, followed by "*">

ParametersParameters

$disposition_header

(string[]) (Required) List of Content-Disposition header values.

ReturnReturn

(string|null) Filename if available, or null if not found.

SourceSource

File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php


			

ChangelogChangelog

Changelog
Version Description
4.7.0 Introduced.
Scroll to Top