I am trying to store PDF documents using their description as the document name. Since the description may contain spaces and characters not permitted in a name I have used urlencode()
to give me a valid doc name.
The first one is “Bridget Barling Thesis: A History of Trinity Grammar School” which contains spaces and a colon.
I can open the document from disk, but if try to open it from localhost, I get a 403 error. If I try from my server, I get a 404.
It is taxing my brain trying to figure out where I’ve gone wrong.
I have written a little script to test it
<?php
$title = 'Bridget Barling Thesis: A History of Trinity Grammar School';
$name = urlencode($title) . '.pdf';
echo '<p>Title: ', $title, '</p>', PHP_EOL;
echo '<p>Name: ', $name, '</p>', PHP_EOL;
echo '<p><a href="', $name, '">', $title, '</a></p>', PHP_EOL;
I’m not even sure I’ve explained myself very well!