FileUpload
class FileUpload (View source)
This class is used to manage file upload using ajax
Properties
| array{script_url: string, upload_dir: string, upload_url: string, param_name: string, delete_type: string, max_file_size: ?int, min_file_size: int, accept_file_types: string, max_number_of_files: ?int, max_width: ?int, max_height: ?int, min_width: int, min_height: int, discard_aborted_uploads: bool, image_versions: array<string, array{upload_dir: string, upload_url: string, max_width: int, max_height: int, jpeg_quality?: int}>} | $options | ||
| protected int | $fk_element | ||
| protected string | $element |
Methods
__construct(?array{script_url?: string, upload_dir?: string, upload_url?: string, param_name?: string, delete_type?: string, max_file_size?: ?int, min_file_size?: int, accept_file_types?: string, max_number_of_files?: ?int, max_width?: ?int, max_height?: ?int, min_width?: int, min_height?: int, discard_aborted_uploads?: bool, image_versions?: array<string, array{upload_dir?: string, upload_url?: string, max_width?: int, max_height?: int, jpeg_quality?: int}>} $options = null, int $fk_element = null, string $element = null)
Constructor.
string
getFullUrl()
Return full URL
void
stdClass
getFileObject(string $file_name)
getFileObject
stdClass>
getFileObjects()
getFileObjects
createScaledImage($file_name, array{upload_dir: string} $options)
Create thumbs of a file uploaded.
bool
validate(string $uploaded_file, object $file, string $error, string $index)
Make validation on an uploaded file
string
upcountNameCallback(int $matches)
Enter description here .
string
upcountName(string $name)
Enter description here .
string
trimFileName(string $name, string $type, string $index)
trimFileName
stdClass|null
handleFileUpload(string $uploaded_file, string $name, int $size, string $type, string $error, string $index)
handleFileUpload.
int
post()
Output data
Details
__construct(?array{script_url?: string, upload_dir?: string, upload_url?: string, param_name?: string, delete_type?: string, max_file_size?: ?int, min_file_size?: int, accept_file_types?: string, max_number_of_files?: ?int, max_width?: ?int, max_height?: ?int, min_width?: int, min_height?: int, discard_aborted_uploads?: bool, image_versions?: array<string, array{upload_dir?: string, upload_url?: string, max_width?: int, max_height?: int, jpeg_quality?: int}>} $options = null, int $fk_element = null, string $element = null)
Constructor.
This set ->$options
protected string
getFullUrl()
Return full URL
protected void
setFileDeleteUrl(stdClass $file)
Set delete url
protected stdClass
getFileObject(string $file_name)
getFileObject
protected stdClass>
getFileObjects()
getFileObjects
protected
createScaledImage($file_name, array{upload_dir: string} $options)
Create thumbs of a file uploaded.
@param string $file_name Filename
protected bool
validate(string $uploaded_file, object $file, string $error, string $index)
Make validation on an uploaded file
protected string
upcountNameCallback(int $matches)
Enter description here .
..
protected string
upcountName(string $name)
Enter description here .
..
protected string
trimFileName(string $name, string $type, string $index)
trimFileName
protected stdClass|null
handleFileUpload(string $uploaded_file, string $name, int $size, string $type, string $error, string $index)
handleFileUpload.
Validate data, move the uploaded file then create the thumbs if this is an image.
int
post()
Output data