• Resolved abyz12345

    (@abyz12345)


    When visitors add a location, I can allow them to add an image or audio. Instead, I’d like them to be able to upload a PDF. We’ve had email communication about this, it wasn’t possible back then. Maybe the community can help me. I’m now accepting the PDF via a separate form after the location has been submitted, but it’s not linked to the location submission.

    In Pro I can add a HTML custom field, but I don’t think I can then somehow link the PDF upload button to the Open User Map data processing.

    Any suggestion on how to accomplish adding PDF files to a location bubble? I can imagine other people would also want to be able to allow other file extension uploads.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter abyz12345

    (@abyz12345)

    I can user a Javascript snippet to overrule the file selection limitation, but it won’t process the PDF unfortunately (as expected):

    document.addEventListener('DOMContentLoaded', function() {
    var fileInput = document.getElementById('oum_location_images');
    if (fileInput) {
    // Optie 1: Alleen PDF toestaan
    // fileInput.accept = 'application/pdf';

    // Optie 2: PDF én afbeeldingen toestaan
    fileInput.accept = 'image/*,application/pdf';

    // Optioneel: Je zou ook het label/icoon kunnen proberen aan te passen
    // Dit is echter kwetsbaarder voor plugin-updates
    // var labelIcon = document.querySelector('label[for="oum_location_images"] span.dashicons');
    // if (labelIcon) {
    // labelIcon.classList.remove('dashicons-format-image');
    // labelIcon.classList.add('dashicons-media-document'); // Icoon voor document
    // }
    }
    });
    Thread Starter abyz12345

    (@abyz12345)

    Not perfect, but if I could somehow pass “oum_post_id” to the Action after submit redirect, I presume I could use an external upload tool and link it to the location with that value.

    Ideally the PDF upload is part of the form itself though.

    Thread Starter abyz12345

    (@abyz12345)

    Maybe to add, I don’t need to expose the PDF to the visitors. It’s for admin view only.

    Thread Starter abyz12345

    (@abyz12345)

    With help of ChatGPT I got this working. I am using a custom HTML form field which processes a PDF upload and inserts the pages as images (whilst storing a copy). Should do the trick for my purpose 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Allow PDF upload’ is closed to new replies.