--- filefield.test      (revision 8)                                                                                                               
+++ filefield.test      (working copy)                                                                                                             
@@ -476,8 +476,10 @@                                                                                                                               
                                                                                                                                                   
     // Setup files for extension checking.
     $test_file = $this->getTestFile('image');
+    preg_match('/(?<=\.)[^\.]*$/', $test_file->filename, $matches);
+    $extention = current($matches);
     $wrong_extension_file = drupal_clone($test_file);
-    $wrong_extension_file->filename = str_replace('.png', '.jpg', $test_file->filename);
+   $wrong_extension_file->filename = str_replace(".$extention", '.jpg', $test_file->filename);
     $wrong_extension_file->filepath = file_directory_path() .'/'. $wrong_extension_file->filename;
     $original_path = $test_file->filepath;
     file_copy($original_path, $wrong_extension_file->filepath);
@@ -492,7 +494,7 @@
     $this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with no extension checking.'));

     // Enable extension checking.
-    $this->updateFileField($field['field_name'], $type->name, array(), array('file_extensions' => 'txt png jpg'));
+   $this->updateFileField($field['field_name'], $type->name, array(), array('file_extensions' => "txt png jpg $extention"));

     // Check that the file can be uploaded with extension checking.
     $nid = $this->uploadNodeFile($test_file, $field['field_name'], $type->name);

