diff --git a/field_file.inc b/field_file.inc
index 33e3b08..70d8e50 100644
--- field_file.inc
+++ field_file.inc
@@ -136,6 +136,9 @@ function field_file_save_file($filepath, $validators = array(), $dest = FALSE, $
   $file->filepath = $filepath;
   $file->filemime = module_exists('mimedetect') ? mimedetect_mime($file) : file_get_mimetype($file->filename);

+  // Transliterates filename when the $_FILES array is not present.
+  $file->filename = _field_transliterate_filename_if_not_post_request($file->filename);
+
   // Rename potentially executable files, to help prevent exploits.
   if (preg_match('/\.(php|pl|py|cgi|asp|js)$/i', $file->filename) && (substr($file->filename, -4) != '.txt')) {
     $file->filemime = 'text/plain';
@@ -195,6 +198,22 @@ function field_file_save_file($filepath, $validators = array(), $dest = FALSE, $
 }

 /**
+ * Transliterates the filename when the $_FILES array is not present. This can
+ * occur when FileField is used programatically (by Migrate Extras module, p.e.).
+ *
+ * @param $filename
+ *    The filename to be transliterated.
+ * @return string
+ */
+function _field_transliterate_filename_if_not_post_request($filename) {
+  $transliterate_on_uploads = variable_get('transliteration_file_uploads', TRUE);
+  if (count($_FILES) == 0 && module_exists('transliteration') && $transliterate_on_uploads) {
+    return transliteration_clean_filename($filename);
+  }
+  return $filename;
+}
+
+/**
  * Save a node file. Delete items if necessary and set new items as permanent.
  *
  * @param $node
diff --git a/tests/filefield.test b/tests/filefield.test
index 912d53d..15e9e1e 100644
--- tests/filefield.test
+++ tests/filefield.test
@@ -553,6 +553,13 @@ class FileFieldPathTestCase extends FileFieldTestCase {
   }

   /**
+   * Implementation of setUp().
+   */
+  function setUp() {
+    parent::setUp('transliteration');
+  }
+
+  /**
    * Test normal formatter display on node display.
    */
   function testUploadPath() {
@@ -597,7 +604,41 @@ class FileFieldPathTestCase extends FileFieldTestCase {
     else {
       $this->assertTrue(TRUE, t('File path token test skipped because the Token module is not available.'));
     }
+  }
+
+  /**
+   * Test transliteration when files are created programatically.
+   */
+  function testFileCreatedProgramatically() {
+    if (! module_exists('transliteration')) {
+      $this->assertTrue(TRUE, t('File created programatically test skipped because the Transliteration module is not available.'));
+    }

+    $field_name = 'field_' . strtolower($this->randomName());
+    $type = $this->drupalCreateContentType();
+    $field = $this->createFileField($field_name, $type->name);
+    $test_file = $this->getTestFile('image');
+
+    $node = new stdClass();
+    $node->type = $type->name;
+    $node->title = $this->randomName(8);
+
+    // Add a space to the filename, replacing '-' with space (Drupal SimpleTest
+    // creates filenames for test with '-', as in image-1.png).
+    $dest_file = preg_replace('/\-/', ' ', basename($test_file->filepath));
+    $dest_file = file_directory_temp() . '/' . $dest_file;
+    file_copy($test_file, $dest_file);
+
+    $file = field_file_save_file($dest_file);
+    $node->$field_name = array();
+    array_push($node->$field_name, $file);
+    node_save($node);
+
+    // Reload the node.
+    $node = node_load($node->nid, NULL, TRUE);
+
+    $node_file = $node->{$field['field_name']}[0];
+    $this->assertPathMatch($file->filepath, $node_file['filepath'], t('The file %file was correctly transliterated.', array('%file' => $node_file['filepath'])));
   }

   /**
