Files not working
-
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?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.
-
@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 :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 :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 :
then you upload these two files - don't change the name - and you can use the files like this :
and
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 :
-
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.
-
@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 ? -
@Gertjan
Ok updated to the latest beta and it works now.
Thank you for your detailed help and understanding. -
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.