如何显示jQuery的文件上传名称多文件上传插件v1.48?如何显示jQuery的文件上传名称多文件上传插件
用户上传文件后,有没有办法显示他们已经上传文件,在配置文件下?
1.if (isset($_FILES['tb-documents'])) {
$documents = $_FILES['tb-documents'];
foreach ($documents['name'] as $key => $value) {
if ($documents['name'][$key]) {
$document = array(
'name' => $documents['name'][$key],
'type' => $documents['type'][$key],
'tmp_name' => $documents['tmp_name'][$key],
'error' => $documents['error'][$key],
'size' => $documents['size'][$key]
);
$status = wp_handle_upload($document, array('test_form' => false));
if(!isset($status['error'])) {
$uploads = wp_upload_dir();
add_user_meta($user->ID, 'tb-documents', $uploads['url'].'/'.basename($status['file']));
}
}
}
}
上传在用户配置文件中运行良好。但是,我想提取他们上传的文件名并将所有上传的文件名显示给他们。
我应该使用哪个变量?
1.I tried this, $content .= '.$documents['name']'; but it doesn't work. It shows syntax error.
嗨,应该使用哪个变量来提取文件名? $ content。='
Download Document #' . ($y+1) . ''; }这是我正在使用的代码,但它将文本链接显示为下载文档。有没有办法将固定下载文档#更改为显示实际文件名的文本? – user2987446
难道你不能使用$ documents ['name'] [$ key]? – dikirill