Sujet : Re: How to link to a file with ampersand in its name
De : robin_listas (at) *nospam* es.invalid (Carlos E.R.)
Groupes : comp.os.linux.miscDate : 07. Sep 2024, 21:27:17
Autres entêtes
Message-ID : <l1muqkxhmk.ln2@Telcontar.valinor>
References : 1
User-Agent : Mozilla Thunderbird
On 2024-09-07 19:59, The Natural Philosopher wrote:
I have a file that has to be called U&blah.png
I cannot find any way to direct the browser to load it
U&blah.png doesnt work
U%26blah.png doesnt work
Using php rawurlencode doesnt work. It effectively does nothing
Any ideas?
I copied a jpg file and renamed it "U&blah.jpg"
On the command line, this works:
w3m U\&blah.jpg
This is direct loading, bypassing apache.
If I put the file in apache path, it also works.
cer@Telcontar:/srv/www/home/cer/ampersand> l
total 12
drwxr-xr-x 2 cer users 4096 Sep 7 21:00 ./
drwxr-xr-x 5 cer root 4096 Sep 7 21:07 ../
-rw-r--r-- 1 cer users 3402 Sep 7 21:00 U&blah.jpg
cer@Telcontar:/srv/www/home/cer/ampersand>
The command "w3m
http://localhost/~cer/ampersand" displays the page:
Index of /~cer/ampersand
Icon Name Last modified Size Description
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[PARENTDIR] Parent Directory -
[IMG] U&blah.jpg 2024-09-07 21:00 3.3K
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Apache/2.4.51 (Linux/SUSE) Server at localhost Port 80
And hitting enter on the file displays the photo it contains (it calls imagemagick, as w3m is a text mode web browser).
Then I tried with firefox, and it also works.
http://localhost/~cer/ampersand/U&blah.jpgSo, no problem! :-)
Oh, I also added a photo with png extension, no problem.
http://localhost/~cer/ampersand/x&inesnap-20020308-195150-1.pngDid I misunderstand something?
-- Cheers, Carlos.