Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @param : $files return
- Array
- (
- [path] => /tmp_uploads/
- [file] => ten.jpg
- [preview] => http://localhost/wc-pro-old/wp-includes/images/media/default.png
- [show_thumbnail] => 1
- [is_image] => 1
- [ext] => jpg
- )
- */
- add_action('dndmfu_wc_pro_upload_complete', function( $files ){
- // Begin validation here ( checking filename or validating file extension )
- if( isset( $files['file'] ) ){
- // File check or validation here
- if( $files['file'] == 'ten.jpg' ){
- // WP upload url
- $base_dir = DNDMFU_WC_PRO_MAIN::get_instance()->wp_upload_dir['basedir'];
- // Concat upload path + filename
- $path = realpath( trailingslashit( $base_dir ) . $files['path'] . $files['file'] );
- // Delete file
- DNDMFU_WC_PRO_FUNCTIONS::get_instance()->dndmfu_wc_delete_file( $path );
- // Return an error (must json error format)
- wp_send_json_error( 'Error: Invalid file etc...' );
- }
- }
- return $files;
- });
Advertisement
Comments
-
- Do you think you should download a free mod at https://techloky.com/ ?
Add Comment
Please, Sign In to add comment
Advertisement