[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/php-ai-client/src/Files/Util/ -> FileInputUtil.php (summary)

Resolves developer-supplied file strings into File objects. This utility backs the convenience of passing a plain string to builder methods such as PromptBuilder::withFile(). Because it may read from the local filesystem, it must only be used with strings the developer controls. Never pass untrusted input (user input, API response data); construct a File explicitly via File::fromUrl(), File::fromDataUri() or File::fromBase64() instead.

File Size: 60 lines (3 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 function

  fromString()

Functions
Functions that are not part of a class:

fromString(string $input, ?string $mimeType = null)   X-Ref
Resolves a file string into a File object.

The string is interpreted, in this order, as an http(s) URL, a data URI, a local file path, or plain
base64 data (which requires a MIME type). Any other URL scheme is rejected before the filesystem is
consulted.

param: string $input The file string.
param: string|null $mimeType The MIME type (optional, required for plain base64 data).
return: File The resolved file.



Generated : Fri Oct 30 08:20:34 2026 Cross-referenced by PHPXref