When uploading files with special characters (umlauts, sometimes spaces cause issues too), the files are being uploaded fine and the preview is being shown in the upload interface. When saving the node and for example, fetching the images using a view, the files with special characters are not being shown and return a 404. I use SWFUpload, Views and ImageCache. It seems that there is something wrong with the transliteration of filenames. You can simply get the same result by uploading a filename consisting of multiple spaces and umlauts.
Comments
Comment #1
dtsomers commentedI ran into the same problem. I'm a complete noob to drupal and php but I was able to find code in image_fupload that seems to help.
I pasted
// do some checks via transliteration module if available
if (module_exists('transliteration')) {
require_once(drupal_get_path('module', 'transliteration') .'/transliteration.inc');
$_FILES['files']['name'][$instance->name] = transliteration_clean_filename($_FILES[$instance->name]['name']);
}
into line 278 of swfupload.module, above the token call.
This seems to work on the file itself and file name display properly after saving the node but I haven't been able to figure out where to change the displayed file name in the upload form.
I tried to get that working using a module and the hooks swfupload provides but I'm missing something and can't get it work.
Comment #2
Anonymous (not verified) commentedI suggest using the transliteration module to handle file renaming to start with. It does a good job at that and most users using anything else than english already have it installed for PathAuto or similar modules.
I'm not sure wether this is a bug or a feature request tho, since the correct renaming should be high priority because it occasionally breaks the proper usage of SWFUpload for everyone with non-ascii chars used on some filenames at some point. I'm not that fond of module development myself, let's kindly ask for help: *help pls* :)
Comment #3
dtsomers commentedExactly. It would be great if it supported pathauto and transliteration by default but, as far as I can tell, it does not. That snippet of code I posted adds in the transliteration functionality I need but I would like a professional solution rather than my hack.
There is a working patch for Filefield_paths at http://drupal.org/node/716328 but I'm only using transliteration. So I second the call for *help pls*, would someone more clever than I show us the way?
Thanks.
Comment #4
Anonymous (not verified) commentedChanging title and priority to get some attention.
Problem:
The modules functionality is broken when using anything else than ASCII chars on filenames and for example, using Views to display uploaded images.
Possible Solution:
Implement sanitizing of filenames via http://drupal.org/project/transliteration
Comment #5
patrickroma commentedsubscribe
Comment #6
patrickroma commentedanybody proceeded with this issue?
Comment #7
Ace Cooper commentedMy site is in Russian, so users sometimes upload pictures with Cyrillic characters, spaces and apostrophes, which led to empty thumbnails of imagecache and broken links to source pictures.
To solve this issue I've used the following:
1. Installed the module FileField Path, which enables the option to sanitize file names with Transliteration or PathAuto.
These settings are located in the Image Field settings of a node type, in my case: admin/content/node-type/object/fields/field_photo
See the settings screenshot.
2. Applied the quick-fix in /sites/all/modules/swfupload/swfupload.module on line 274 by replacing:
$_FILES['files']['name'][$instance->name] = $_FILES[$instance->name]['name'];with the following code:This completely solved my issues with non-ASCII96 filenames.
Comment #8
patrickroma commentedComment #9
eyolf commented#7 solved the file name issue for me, but the file path is still not sanitized. Can someone suggest a way to fix that too?
Comment #10
chichilatte commentedIf you're using the IMCE SWFUpload module and have the same problem, you should see this page