uo_tincanny_uploader_max_upload_size
Filters the maximum upload size for the Tincanny uploader, allowing modification of the default limit.
add_filter( 'uo_tincanny_uploader_max_upload_size', $callback, 10, 1 );
Description
Filters the maximum file upload size for the Tincanny zip uploader. Developers can use this hook to dynamically adjust the allowed upload size for individual files within a zip upload, overriding the default WordPress limit for this specific feature.
Usage
add_filter( 'uo_tincanny_uploader_max_upload_size', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Increase the maximum chunk upload size for Tincanny Uploader to 4MB.
*
* This filter allows administrators to override the default chunk upload size
* configured within the Tincanny Zip Uploader plugin.
*
* @param int $max_upload_size The current maximum upload size in bytes.
* @return int The modified maximum upload size in bytes.
*/
function my_custom_tincanny_chunk_upload_size( $max_upload_size ) {
// The default is 2MB (1024000 * 2). Let's increase it to 4MB.
$new_max_upload_size = 1024000 * 4; // 4 MB in bytes
// You might want to add some conditional logic here, for example,
// only apply this change for certain user roles or based on a plugin setting.
// For this example, we'll just unconditionally set it.
return $new_max_upload_size;
}
add_filter( 'uo_tincanny_uploader_max_upload_size', 'my_custom_tincanny_chunk_upload_size', 10, 1 );
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
src/tincanny-zip-uploader/tincanny-zip-uploader.php:108
'nonce' => wp_create_nonce( 'tincanny-zip-uploader' ),
'rest_nonce' => wp_create_nonce( 'wp_rest' ),
'rest_url' => esc_url_raw( rest_url() ),
'rest_namespace' => 'tincanny/v1/handle_zip_uploads',
'max_upload_size' => array(
'full_zip_upload' => $full_zip_max_size,
'files_upload' => apply_filters( 'uo_tincanny_uploader_max_zip_size', $files_max_size ),
'chunk_upload' => apply_filters( 'uo_tincanny_uploader_max_upload_size', 1024000 * 2 ), // 2 MB in bytes.
'post_max_size' => wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) ),
),
'module_types' => $this->module_config( true ),
'invalid_files' => $this->invalid_files(),
'max_filename_length' => 255,
'debug' => UO_TINCANNY_UPLOADER_DEBUG ? 1 : 0,
'i18n' => array(