Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Files not working

    Scheduled Pinned Locked Moved Captive Portal
    6 Posts 2 Posters 787 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q Offline
      Quirin
      last edited by

      Hey guys,
      i'm using the captive portal function of pfsense without https. Default portal.
      I made a custom portalpage layout.
      When i use base64encoding and load the images from it's real path (DIR) /usr/local/captiveportal/file.... than it works. But using the impemented relative path of filedirectory, no file work.
      Is there something i missunderstand or is this a bug?

      Screenshot 2025-04-10 122707.jpg

      Screenshot 2025-04-10 122546.jpg

      Screenshot 2025-04-10 122525.jpg

      Screenshot 2025-04-10 124104.jpg

      Can anyone help me here, i would like to use the correct implemented way to load and use file uploads instead of selfmade php code.

      GertjanG 1 Reply Last reply Reply Quote 0
      • GertjanG Offline
        Gertjan @Quirin
        last edited by

        @Quirin said in Files not working:

        When i use base64encoding

        You don't use "base64encoding" : you don't have to base encode the file yourself.
        You create a some-same-here.html, and you upload that file. Done.
        The upload id done here :

        00c2e9d0-6e86-41cf-aa07-1a66577ce722-image.png

        The other important file is the "error' page.
        This could be the same file as the login page, with one or two lines more : example :

        eeeb9a16-3298-4cb5-9992-79ea33909cb9-image.png

        How and where the files are stored : "you don't care". Let pfSense do its thing, and all goes well.

        If you want to source other files from the login or error page, for example tehse two :

        73327b9d-fb7c-4b02-8e40-0e507a84aea0-image.png

        then you upload these two files - don't change the name - and you can use the files like this :

        94e3de68-1935-44c8-88a0-039e9557d2d4-image.png

        and

        0d98e0b2-1cc6-4ee2-bf82-4fe21ee4eb8c-image.png

        So : in the html source file you prepend "captiveportal-" to the file name you've uploaded above..

        Btw : It's possible to embed php stuff in the html file :

        b9761def-2a93-4754-8923-40757a77164d-image.png

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        1 Reply Last reply Reply Quote 1
        • Q Offline
          Quirin
          last edited by

          Thank you for the reply and detailed description, but have you read my message and saw my images?

          I don't know how to tell more precise.
          To make it more clear:
          Step 1: i enable captive portal under Service->Captive Portal.
          Step 2: i click on edit.
          Step 3: I Click on File Manager and upload files

          • background.jpg
          • logo.png
            Step4:
            Under configure -> Enable to use a custom captive portal login page -> i uploaded a custom mycustomportal.php file.
            I load the image files like you can see in the images in my previous post in the mycustomportal.php with
            !!!! <img id="logo" src="captiveportal-logo.png" alt="logo" /><br> !!!!

          Everything works, except the images, and any other file from the upload.
          The files are not loaded correctly, not like pfsense should.

          A current workarround for me is using the base64encode(DIR . " /captiveportal-logo.png"); But i want to get rid of this.

          Hope it makes it more clear.

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG Offline
            Gertjan @Quirin
            last edited by

            @Quirin said in Files not working:

            I don't know how to tell more precise.

            It was already precise enough 👍
            I was doing the same thing on my side, double checking for an oversight.

            The thing is : I don't use 2.7.2 anymore. It 25.03. I can't downgrade, but you could go to 2.8.0-Beta.
            I can't recall if there were any issue as 2.7.2, I know I was using it for a while.
            You have the System Patches package and activated all the Netgate patches ?

            You do see the symlinks in the /usr/local/captiveportal :

            [25.03-BETA][root@pfSense.bhf.tld]/usr/local/captiveportal: ll
            total 2182
            -rw-r--r--  1 root wheel 2139650 Feb  2  2024 ROOM-DIRECTORY-BH-FUMEL.pdf
            lrwxr-xr-x  1 root wheel      43 Nov 19  2023 captiveportal-2style.css@ -> /var/db/cpelements/captiveportal-2style.css
            lrwxr-xr-x  1 root wheel      43 Nov 19  2023 captiveportal-custom.css@ -> /var/db/cpelements/captiveportal-custom.css
            -rw-r--r--  1 root wheel   82730 Mar  5 21:09 captiveportal-default-logo.png
            lrwxr-xr-x  1 root wheel      47 Nov 19  2023 captiveportal-mac-block.html@ -> /var/db/cpelements/captiveportal-mac-block.html
            lrwxr-xr-x  1 root wheel      46 Nov 19  2023 captiveportal-nvxx-logo.png@ -> /var/db/cpelements/captiveportal-nvxx-logo.png
            -rw-r--r--  1 root wheel    5686 Dec 10  2019 favicon.ico
            -rw-r--r--  1 root wheel   14606 Mar 25 15:48 index.php
            -rw-r--r--  1 root wheel   14498 Mar  3 15:53 index.php.old
            -rw-r--r--  1 root wheel   14474 Mar  5 21:09 index.php.orig
            -rw-r--r--  1 root wheel    3072 Jan  7 12:36 rfc8910.php
            

            and you checked the symlink image and font files ?

            You had the inspector windows of your browser open.
            What was the error when you hover over the place where the logo should show up ?
            File not found ?
            What was the file name of the logo image file in the html ?

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 0
            • Q Offline
              Quirin
              last edited by

              @Gertjan
              Ok updated to the latest beta and it works now.
              Thank you for your detailed help and understanding.

              1 Reply Last reply Reply Quote 0
              • Q Offline
                Quirin
                last edited by

                Ok that was too, quick it seems that this was my Phone cache. The page does not load the uploaded files. Not any of them.
                When i use the Preview of the page or use my phone or device, it shows a blank icon where it should show the logo or the background image.
                When i click on the Preview button the page opens and show the same behavior like the user Devices, http://192.168.7.1:8002/captiveportal-background.jpg.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.