将文件传递给Wordpress wp_handle_upload

时间:2014-01-30 16:31:40

标签: wordpress

我正在尝试将文件传递给Wordpress wp_handle_upload。通常它应该得到$ _FILES数组,所以我尝试手动创建它,比如

$uploadedfile = array ( 'filePhoto' => array ( 'name' => $name, 'type' => 'image/png', 'tmp_name' => $file, 'error' => 0, 'size' => 178890, ), );
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );

但由于某种原因,文件未复制到uploads目录。任何提示?

谢谢

1 个答案:

答案 0 :(得分:1)

你想要的是wp_handle_sideload

上传仅适用于实际上传! :)

相关问题