Hi,
I want to upload files to an additional upload folder. All files with 'canada' in their name.
I use upload_dir to create a custom upload folder:
function custom_upload_dir( $custom_dir ) {
$dir = WP_CONTENT_DIR . '/userfiles';
$url = WP_CONTENT_URL . '/userfiles';
$bdir = $dir;
$burl = $url;
$custom_dir = array(
'path' => $dir,
'url' => $url,
'basedir' => $bdir,
'baseurl' => $burl,
'error' => false,
);
return $custom_dir;
}
add_filter( 'upload_dir', 'custom_upload_dir' );
Now all uploaded files are listed in the userfiles directory.
So I thought including this does the trick:
$mystring = $_SERVER["REQUEST_URI"];
$findme = 'canada';
$pos = strpos($mystring, $findme);
if ($pos === true) {
But no!
I notice this in codex:
Using this, in conjunction with the wp_handle_upload_prefilter, you can dynamically determine which directory to upload to, based on the files you upload.
But, how can I do that?
Guido