[b]Q:[/b] I have a [url=http://drupal.org/project/cck]CCK[/url] [url=http://drupal.org/project/imagefield]ImageField[/url] for uploading pictures to my content type. It all works fine until a user tries to upload an image with an ampersand (&) or another funny character in the filename - The thumbnail will display in the node edit screen but otherwise I can't see the image in the node display or in views etc. What can I do? I can't force my users to upload images without ampersands!!
[b]A:[/b] You can use the [url=http://drupal.org/project/transliteration]Transliteration[/url] module to sanatise upload filenames including ImageField filenames. It will change the filename when the file is uploaded, replacing things like spaces and ampersands with underscores.
We have hit this problem before, especially on one of our Cork client's websites. You can't always control the filenames that people use when uploading images to your website and so it is no good when an image uploaded by one of your visitors won't display because of an ampersand in the filename. This is the kind of thing that you would expect drupal to handle out of the box...
Well the good news is that the [url=http://drupal.org/project/transliteration]Transliteration[/url] can help. Just download it, install and enable it. Once installed it will sanitise upload filenames when the files is uploaded.
It adds some settings to the 'Admin / File System page' (admin/settings/file-system), but you probably won't have to change them - just install & go!
The settings are:
Checkbox - [b]Transliterate file names[/b] during upload, this switches on the automatic sanitisation functionality so you will probably want this checked, default values is checked.
Checkbox - [b]Lowercase transliterated file names[/b] this just puts filenames to lowercase to help with case-insensitive file systems. This is not really relevant to the ampersand problem but it does no harm, default values is checked.
Once installed the module won't fix any images that have already been uploaded, but any images uplaoded after this should be ok.