Naming files to avoid problems (Part 1)

Over the next few days, I’m going to talk about how to give your documents names if they’re going on the web …and what documents aren’t, these days? This might sound a bit geeky (after all, who wants to be told how to name documents?), but it can save you a lot of grief in the future.

First of all, we have to undo a lot of the good work which has been done over the last 20 years. On your PC, it’s been a long time since you had to call your files by one word: there’s no problem with saving that Microsoft Word document as “How Our Blue Widgets Work” – a whole generation has grown up knowing nothing of the restrictions we had to work under when MS-DOS ruled the world. However, spaces can cause all sorts of problems inside web addresses (“URLs”), so they really should be avoided. Most people use website design or content management systems which won’t allow you to upload web pages with spaces in the names, but it’s a big problem for the unenlightened who upload image (e.g .jpg) or PDF documents with spaces in their names and then call them into their web pages.

For example, I’ve just created an image called “blue widgets”, saved it as a JPEG file (so on my PC it’s called “blue widgets.jpg” – note the space), and uploaded it to our website, where I can see the file has the same name. So in theory, the web address of the image should be:
www.bmon.co.uk/images/blue widgets.jpg

Click on that and the result you’ll get will depend on the intelligence of the browser you’re using. On mine, it miraculously changes the space to “%20” and ends up finding the right file, because it turns out that my web server has replaced the space with an invisible character representing the space which can be accessed using the code “%20”. Try clicking on that link: you may get through to the right image too. But there’s no guarantee. So just avoid spaces in the filename when saving files to be used on the web, whether they’re web pages (“HTML”), JPEG images, PDF documents or anything else. It’s a small concession to the world of the computer geeks which will might make your life easier.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.