of_sanitize_upload

File upload sanitization.

Description

of_sanitize_upload( (string) $input ); 

Returns a sanitized filepath if it has a valid extension.

Parameters (1)

0. $input (string)
The input.

Usage

  1. if ( !function_exists( 'of_sanitize_upload' ) ) { 
  2. require_once '/inc/includes/class-options-sanitize.php'; 
  3.  
  4. // The input. 
  5. $input = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = of_sanitize_upload($input); 
  9.  

Defined (1)

The function is defined in the following location(s).

/inc/includes/class-options-sanitize.php  
  1. function of_sanitize_upload( $input ) { 
  2. $output = ''; 
  3. $filetype = wp_check_filetype( $input ); 
  4. if ( $filetype["ext"] ) { 
  5. $output = esc_url( $input ); 
  6. return $output;