When using the wp_handle_upload function it is returning the following error
Array([error] => Specified file failed upload test.)
The code I am using is as follows
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);
}
}
Standard admin media upload is working fine but this seems to be causing issues.
Can anyone give me some advice on this, have updated ini files and so on with no improvement.
Thanks.
Problem was I was getting the following
instead of getting