Good %time of day%!

When I upload a file with name in non-ASCII, transliteration doesn't occur. I think, it is a bug!

Comments

dicreat’s picture

Assigned: Dark Neo » Unassigned
Priority: Normal » Major

Confirming that is a bug.

cweagans’s picture

Project: » Multiupload Filefield Widget
czigor’s picture

Project: Multiupload Filefield Widget » Transliteration
Version: 7.x-1.x-dev » 7.x-3.x-dev
Component: User interface » Code
Category: bug » feature
Priority: Major » Normal

This is a transliteration module issue. Its hook_init should be rewritten to support the multiple html5 attribute.

berosoboy’s picture

The transliteration module supports multiple file upload. The bug occurs because the attribute name of multiupload input is not "files", so it cannot be taken by $_FILES['files'] in transliteration_init().

I tried to fix the code. This works for me, but is applied to all files in $_FILES:

function transliteration_init() {
  //Apply to all files in $_FILES
  if (!empty($_FILES) && variable_get('transliteration_file_uploads', TRUE)) {
    // Figure out language, which is available in $_POST['language'] for node
    // forms.
    $langcode = NULL;
    if (!empty($_POST['language'])) {
      $languages = language_list();
      if (isset($languages[$_POST['language']])) {
        $langcode = $_POST['language'];
      }
    }

    foreach($_FILES as &$file) {
      // multiple files
      if(is_array($file['name'])) { 
        foreach ($file['name'] as $field => $filename) {
          // Keep a copy of the unaltered file name.
          $file['orig_name'][$field] = $filename;
          $file['name'][$field] = transliteration_clean_filename($filename, $langcode);
        }
      }
      // single file
      else {
        $filename = $file['name']; 
        $file['orig_name'] = $filename;
        $file['name'] = transliteration_clean_filename($filename, $langcode);
      }
    }
  }
}

Sorry, my english is not good.

moonray’s picture

Issue tags: +needs backport to 6.x

Same issue in the D6 version of transliteration.

czigor’s picture

Project: Transliteration » Multiupload Filefield Widget
Version: 7.x-3.x-dev » 7.x-1.x-dev
Status: Active » Closed (duplicate)

I was wrong, this turned out to be an MFW issue.
As there's a patch here:
#1748646: Transliteration module support
I mark this as duplicate.