【发布时间】:2017-10-01 19:49:41
【问题描述】:
谁能告诉我为什么这个函数没有将上传的文件移动到任何地方。
function handle_logo_upload($option){
if(!function_exists('wp_handle_upload'))
{
require_once(ABSPATH .'wp-admin/includes/file.php');
}
if(!empty($_FILES["site_logo_custom"])){
$theFile=$_FILES["site_logo_custom"];
$overrides=array('test_form'=>false);
$urls=wp_handle_upload($theFile,$overrides);
$temp=$urls["url"];
return $temp;
}
return $option;
}
我真的找不到太多关于 wp_handle_upload 函数的信息。 谢谢!!!
【问题讨论】:
-
这个函数在哪里?而且它没有被我看到的人调用?您如何将此功能作为表单操作运行?
-
嗨 Sajjadur,它在我主题的功能模板中。这是设置页面的一个字段,我在谷歌搜索了一段时间后在一些教程中发现了这种方法。我找到了另一种基于 jQuery 的方法,但我更喜欢将数据集合留在 php 上。