File_Upload extends Base_Route implements Route

REST controller for the uploading files from the frontend.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Route

Table of Contents

$rest_base  : mixed
$extension  : mixed
$mime_type  : mixed
add_allowed_mime_type()  : mixed
create()  : WP_REST_Response|WP_Error
Upload file.
custom_upload_dir()  : array<string|int, mixed>
Custom upload directory.
permission_callback()  : bool
Permission callback.
register_routes()  : mixed
Register the REST routes.
is_allowed_file_type()  : mixed
Check if the file extension is allowed for the option.

Properties

$rest_base

protected mixed $rest_base = 'file-upload'
Tags

Methods

add_allowed_mime_type()

public add_allowed_mime_type(mixed $mime_types) : mixed
Parameters
$mime_types : mixed
Tags
Return values
mixed

create()

Upload file.

public create(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
$request : WP_REST_Request
Tags
Return values
WP_REST_Response|WP_Error

custom_upload_dir()

Custom upload directory.

public custom_upload_dir(array<string|int, mixed> $path_data) : array<string|int, mixed>
Parameters
$path_data : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

$path_data

permission_callback()

Permission callback.

public permission_callback() : bool
Tags
Return values
bool

register_routes()

Register the REST routes.

public register_routes() : mixed
Tags
Return values
mixed

is_allowed_file_type()

Check if the file extension is allowed for the option.

private is_allowed_file_type(array<string|int, mixed> $file_data, Option $option) : mixed
Parameters
$file_data : array<string|int, mixed>
$option : Option
Tags
Return values
mixed

Search results