- pathinfo: documentation ( source)
- strtolower: documentation ( source)
<?php
function get_bcv_filename($get_the_path){
$path_name = pathinfo($get_the_path, PATHINFO_DIRNAME);
$base_name = pathinfo($get_the_path, PATHINFO_BASENAME);
$file_name = pathinfo($get_the_path, PATHINFO_FILENAME); // get and store the files name
$ext_name = pathinfo($get_the_path, PATHINFO_EXTENSION); // get and store the files original extension
echo $path_name;
//echo $base_name;
//$my_file_src = "http://ballerscv.media2/wp‑content/uploads/"; // get folder where converted files are now stored
$my_file_src = "http://ballerscv.media2/wp-content/uploads/";
$new_file_ext =".mp4"; // non mp4 files are being converted to mp4 so will have this extension.
// if the file is an mp4 file it won't be converted to mp4 so get the original file folder and extension
if ( strtolower($ext_name) == "m4v" || strtolower($ext_name) == "mp4"){
//$my_file_src = "http://ballerscv.com/wp‑content/uploads/formidable/"; // set folder to original file folder
$my_file_src = $path_name . "/" ;
$new_file_ext = "." . $ext_name; // set extension to original extension
}
$new_file = $my_file_src . $file_name . $new_file_ext;
return $new_file;
}
//echo pathinfo("http://ballerscv.com/wp‑content/uploads/formidable/everyfile.flv", PATHINFO_DIRNAME);
echo get_bcv_filename("http://ballerscv.media2/wp-content/uploads/formidable/everyfile.flv");
?>