As much as a little part of me dies every time I’ve got to put a pdf file on a website, it does happen. And usually the file name sports non-web-friendly spaces, ampersands and annoying uppercased words. While people should be allowed to name things how they want, when files move from desktop to web there’s a right and a wrong way to do things, and I can never remember if it’s %20 or %20% for a hyperlink-able space.
So instead of trawling (alright then, after) for a application that would batch rename files, I wrote my own in 15 lines of PHP – download rename.php.txt. By giving you the line count I’m not claiming that I’m a PHP guru or anything, just that it’s really pretty easy to do this sort of thing without having to hand over any money.
All you have to do is put your human-readable pdfs in a folder in your PHP enabled webserver, put rename.php in the same folder, navigate to rename.php in a web browser and the job’s done (I keep a copy of the original pdfs in another folder in case something goes wrong). I’ve even added a bit more PHP that writes the html that you’ll need as a starting point, including the size of the file.
And the other good thing about this, even though I’ve been going on about pdfs, is that this script doesn’t care what sort of files they are. You could rename jpgs, pngs, whatever. And if you know a bit about string manipulation in PHP you can shorten file names to a particular length, add prefixes or suffixes, whatever you need for that particular job.
How to educate your end users to stop sending you pdfs and start sending you documents written for the web, properly formatted and marked up in html, is left as an exercise for the reader. Though if you have a script for that, please send me a copy. Please.
Just in case anyone isn’t entirely sick of me saying it by now I sometimes help out in my girlfriend’s flower shop on the weekends or busy times. This in itself isn’t unusual, but over the last weekend, delivering flowers for the UK’s Mothers’ Day, I have learned something that connects the world of floristry, or more specifically, delivering flowers (as I’m not let anywhere near the making of stuff), and web design.
As web designers and developers, we might not be able to see anything wrong with the average ‘so what’s your address’ part of the web forms we write every day. Ask for an address, in a textarea or series of input boxes. Ask for a postcode. Ask for a county, ask for a country. You might even do clever things so that people only need to put in their postcode and house number. These are all pretty straightforward things. Aren’t they?
Well, I’m here to tell you that behind every fifth? sixth? address for delivery that we get at the shop, lies a world of pain for the poor soul who has to match up a seemingly simple address with the task of delivering flowers to the front door of a real house. For some Englishmen, their house is not just a metaphorical castle, but a castle with the drawbridge up and the boiling oil ready to drop.
Here are some alarm bells that I’d say most web forms don’t currently consider:
If you can, let someone else do this delivery. Because delivering to a house with no number, just a name, will usually result in you driving at five miles an hour up and down a (usually very long) country lane, stopping in front of each house, scanning the gate, the other gate, the eaves, the space next to the front door, the space in the porch next to the front door, the bottom of the tree next to the house but actually on the grass verge. You will probably need to do this three or four times before the house name finally reveals itself.
How could our web forms cope with this? Requiring a latitude and longitude if you don’t give a house number? A simple description of the house? The make of car that’s parked in the drive? There must be something we can do to lessen the agony.
So I’m looking for number 24. I can find number 20, and after a big tree filled gap, down the road is number 32. Where’s are the houses with the missing numbers? Well, they’re down a unmarked lane, of course.
What could the form ask here? ‘Is your house actually on the street you’ve typed into the form, or only vaguely related to it?’.
This one always gets me. I get out of the car with the flowers and walk confidently towards number 33 on the corner, which must be next to number 31 (I’ve seen the number as I drove past). Hang on, this house is numbered 1 – ah, it’s the start of the next road. I know it’s only another few paces but it gets me every time.
I’ll admit that adding a question about ‘Is your house confusingly at the intersection of two roads?’ might be a bit much.
Here’s my drill. Turn into road, try and find any house number. It can take a while. Once I’ve found a house with a number at least I know which side is even and odd, and if I need to go up or down. Then, even if you’ve decided your house is too posh for a number, I can find you by the application of (my own brand of) logic.
Is ‘could you please explain why your house doesn’t need a house number?’ possibly too aggressive a question to ask on a web form in this situation?
So I’d recommend everyone who designs a form that ends up with someone delivering something made out of atoms, not electrons, go out and try delivering stuff themselves: at least (if you’re in the UK, the rest of the world might be perfectly labelled) it’ll bring home the difference between successful form submissions in the the web world and the real world.