使用wp_handle_upload函数时,它返回以下错误
Array([error] => Specified file failed upload test.)
我正在使用的代码如下
function dc_form_image_upload() {
if ( ! function_exists( 'wp_handle_upload' ) ) {
require_once( ABSPATH . 'wp-admin/includes/file.php' );
}
$uploadedfile = $_POST['file'];
//print_r($uploadedfile);
// die();
$upload_overrides = array( 'test_form' => false );
$movefile = wp_handle_upload( $uploadedfile, $upload_overrides );
if ( $movefile && !isset( $movefile['error'] ) ) {
echo "File is valid, and was successfully uploaded.\n";
var_dump( $movefile);
} else {
/**
* Error generated by _wp_handle_upload()
* @see _wp_handle_upload() in wp-admin/includes/file.php
*/
print_r($movefile);
}
}
标准管理员媒体上传工作正常,但这似乎引起了问题。
谁能给我一些建议,更新ini文件等等,但没有任何改善。
谢谢。
问题是我得到以下内容
$uploadedfile = $_POST['file']
而不是得到
$uploadedfile = $_FILES['file']
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句