1

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);
            }
        }
    }
}

1 Answer 1

1

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 and acknowledge you have read our privacy policy.

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