• I am using my plugin to retrieve files from a webservices and save them into my wordpress, it properly works and save them into the upload directory but I cant find them in media library.

    my code is as following

    require("/Applications/MAMP/htdocs/wordpress/wp-load.php");
    
    $Addr = "https://www.xxx.com" . $Addr;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 0);
    curl_setopt($ch, CURLOPT_URL, $Addr);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $output = curl_exec($ch);
    curl_close($ch);
    
    ini_set( 'display_errors', TRUE );
    error_reporting( E_ALL );
    
    $upload_dir = wp_upload_dir();
    $location= $upload_dir['basedir']. "/" . "a.jpg";
    
    file_put_contents($location, $output);
    echo 'Photo is uploaded';
  • The topic ‘Files are uploaded using plugin but cant find files in media’ is closed to new replies.