Reputation: 2736
I'm trying to pass file to Wordpress wp_handle_upload. Normally it should get $_FILES array, so I tried to create it manually, like
$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 );
But the file for some reason isn't copied to uploads directory. Any hints?
Thanks
Upvotes: 0
Views: 961
Reputation: 2186
What you want is wp_handle_sideload
upload is only for actual uploads! :)
Upvotes: 1