我正在使用wp_handle_upload
从主题模板文件上载文件。
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\'];
}
我想在root/uploads目录中创建一个文件夹,用户名为正在上载的用户,并在文件夹中上载文件。
有什么帮助吗?