I am using wp_handle_upload
to upload files from a theme template file.
if ( ! function_exists('wp_handle_upload') ) require_once( ABSPATH . 'wp-admin/includes/file.php' );
$uploadedfile = $_FILES['attachedfile'];
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile ) {
//echo "File is valid, and was successfully uploaded.\n";
//var_dump( $movefile);
$attachedfilelink=$movefile['url'];
}
I want to create a folder inside root / uploads directory with user name of who is uploading and upload the file inside the folder.
Any help ?