Is it supposed to? My code:

if ($_POST && $_FILES) {
    $tmp_name = $_FILES['file']['tmp_name'];
    $item = $_FILES['file'];
    $uploads = wp_upload_dir();
    if (is_writable($uploads['path'])) {
        if (!empty($tmp_name))  {
            if ($tmp_name) {
                $overrides = array('test_form' => false);
                $file = wp_handle_upload($item, $overrides);

To list uploaded file in the media library use wp_insert_attachment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.