Description
Can we alter the filter in wp_handle_upload to control where the file gets stored and the download URL for it?custom backgrounds and custom headers are created using wp_file_upload then wp_insert_attachment by renaming the .zip file then it's no longer accessible from the uploads directory BUT we still have links to it and to all intents and purposes it still exists. So now we can intercept calls to download?plugin=fred&version=1.18 and access the file from the renamed directory.
Usage
oikp_create_new_file_name( $old_file );Parameters
- $old_file
- ( mixed ) required –
Returns
voidSource
File name: oik-plugins/oik-plugins.phpLines:
1 to 20 of 20
function oikp_create_new_file_name( $old_file ) { //global $pagenow; $file = basename( $old_file, ".zip" ); list( $plugin, $version ) = explode( ".", $file, 2); if ( $plugin && $version ) { $zipdir = bw_get_option( "zipdir", "bw_plugins_server" ); if ( PHP_OS == "WINNT" ) { $new_file = "C:\\{$zipdir}\\"; } else { $new_file = oikp_build_external_dir( "/{$zipdir}/" ); } $new_file .= $plugin; $new_file .= "."; $new_file .= $version; $new_file .= ".zip"; } else { $new_file = null; } return( $new_file ); }View on GitHub
Called by
1 to 2 of 2
Invoked by
Call hooks
API Letters:
