wp_handle_upload() works, but image not in media library
-
I’m uploading images to a multisite network using cordova-plugin-file-transfer using the following:
function get_file() { if ( ! function_exists( 'wp_handle_upload' ) ) require_once( ABSPATH . 'wp-admin/includes/file.php' ); $uploadedfile = $_FILES['file']; $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"; echo $_FILES[file]['who'] . '**************************************************************\n'; var_dump( $movefile ); } else { /** * Error generated by _wp_handle_upload() * @see _wp_handle_upload() in wp-admin/includes/file.php */ echo $movefile['error']; } }
The image is being written to the proper place in upload directory by wp_handle_upload, but doesn’t show up as part of the media library.
Anyone have a clue why the image isn’t being shown in the library?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘wp_handle_upload() works, but image not in media library’ is closed to new replies.