i do that with some line of code
add this to function.php to change the uploaded file dir
// change dir for anomaly images
function example_Dir( $param ){
$param['path'] = '/home/yoursite/domains/yoursite.com/public_html/wp-content/uploads/example';
$param['url'] = ' https://yoursite.com/wp-content/uploads/example';
return $param;
}
here is the form :
<form action="" enctype="multipart/form-data" method="post" >
<input type="file" name="file">
<input type="submit">
</form>
then what PHP code you need thisis
if(isset($_FILES['file'])){
$file = $_FILES['file'];
add_filter('upload_dir', 'example_Dir');
$Result = wp_handle_upload($file , $upload_overrides);
remove_filter('upload_dir' , 'example_Dir');
}
done!