-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
90 lines (83 loc) · 3.1 KB
/
code.power
File metadata and controls
90 lines (83 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* Set the $useStreams property to use streams for file handling
*
* @param bool $useStreams True to use streams, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setUseStreams(bool $useStreams): self;
/**
* Set the $allowUnsafe property to allow or disallow unsafe file uploads.
*
* @param bool $allowUnsafe True to allow unsafe file uploads, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setAllowUnsafe(bool $allowUnsafe): self;
/**
* Set the $safeFileOptions property to define options for file safety checks.
*
* @param array $safeFileOptions An array of options for InputFilter::isSafeFile.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setSafeFileOptions(array $safeFileOptions): self;
/**
* Set the $enqueueError property to control error reporting behavior.
*
* @param bool $enqueueError True to enqueue error messages, false to store them in the internal error array.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setEnqueueError(bool $enqueueError): self;
/**
* Set the $legalFormats property to define legal file formats.
*
* @param array $legalFormats An array of allowed file formats (e.g., ['jpg', 'png']).
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setLegalFormats(array $legalFormats): self;
/**
* Get a file from the input based on field name and file type, then process it.
*
* @param string $field The input field name for the file upload.
* @param string $type The type of file (e.g., 'image', 'document').
* @param string|null $filter The filter to apply when uploading the file.
* @param string|null $path The directory path where the file should be saved.
*
* @return array|null File details or false on failure.
* @since 3.0.11
*/
public function getFile(string $field, string $type, string $filter = null, string $path = null): ?array;
/**
* Remove a previously uploaded file.
*
* This method uses the same internal removal mechanism as the uploader,
* ensuring consistent cleanup logic across the system.
*
* It accepts either:
* - a full filesystem path
* - or a filename resolvable by Path::clean
*
* @param string $path Absolute or relative file path.
*
* @return bool TRUE on success, FALSE on failure or missing file.
*
* @since 5.1.4
*/
public function removeFile(string $path): bool;
/**
* Get the error messages as a string.
*
* @param bool $toString The option to return errors as a string
*
* @return string|array Returns the error messages as a single concatenated string.
* @since 5.0.3
*/
public function getErrors(bool $toString = true): string|array;