• zeddgre

    (@zeddgre)


    Hi,

    WordPress 6.4.3, OSM 6.1.0 (but pbm already existed on previous version).

    Even though it says “Le plugin OSM a ajouté : GPX / KML” in the media library, attempting to upload a kml file returns a “test.kml Désolé, vous n’avez pas l’autorisation de téléverser ce type de fichier.” (ie you don’t have the right to upload such a file).

    We did a Insta-WP install of a fresh WP with OSM and we do see the same exact problem … of course there is a way to allow upload of kml files (using functions.php, a few lines of code) but I guess it would be better if OSM was really able to allow these files instead of just saying it did allow them ??

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author MiKa

    (@photoweblog)

    Hello @zeddgre

    thanks for your feedback – this upload and the rules changed several time – we will have again a loot to it.

    Br, Michael

    Thread Starter zeddgre

    (@zeddgre)

    We had to do this:

    function custom_mime_types($mimes) {
    // Autoriser les fichiers KML
    $mimes['kml'] = 'application/vnd.google-earth.kml+xml';
    return $mimes;
    }
    add_filter('upload_mimes', 'custom_mime_types');

    function allow_kml_upload( $data, $file, $filename, $mimes ) {
    // Vérifiez si l'extension du fichier est kml
    $ext = pathinfo( $filename, PATHINFO_EXTENSION );
    if ( $ext === 'kml' ) {
    // Ajout de l'extension et du type MIME correct
    $data['ext'] = 'kml';
    $data['type'] = 'application/vnd.google-earth.kml+xml';
    $data['proper_filename'] = $filename;
    }
    return $data;
    }
    add_filter( 'wp_check_filetype_and_ext', 'allow_kml_upload', 10, 4 );
    `</code></pre>
    Plugin Author MiKa

    (@photoweblog)

    Hi @zeddgre

    thanks for your example – we experimented a bit and did some tests – but we did not succeed in our test environment and we couldn’t find any documentation with solving tips. Maybe it’s something to do with our testsystem .
    you can see the code in the osm file, it is commented out. maybe it works for you….

    Br, Michael

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.