diff --git a/filefield_paths.module b/filefield_paths.module
index eb53ba7..ada4d4e 100644
--- a/filefield_paths.module
+++ b/filefield_paths.module
@@ -19,7 +19,7 @@ function filefield_paths_filefield_paths_field_settings() {
           '#maxlength' => 512,
           '#size' => 128,
           '#element_validate' => array('token_element_validate'),
-          '#token_types' => array('file', 'node'),
+          '#token_types' => array('file', 'node', 'comment'),
         ),
       ),
     ),
@@ -34,7 +34,7 @@ function filefield_paths_filefield_paths_field_settings() {
           '#title' => t('File name'),
           '#default_value' => '[file:ffp-name-only-original].[file:ffp-extension-original]',
           '#element_validate' => array('token_element_validate'),
-          '#token_types' => array('file', 'node'),
+          '#token_types' => array('file', 'node', 'comment'),
         ),
       ),
     )
@@ -364,6 +364,34 @@ function filefield_paths_node_update($node) {
 }
 
 /**
+ * Implements hook_comment_insert().
+ */
+function filefield_paths_comment_insert($comment) {
+  filefield_paths_comment_update($comment);
+}
+
+/**
+ * Implements hook_comment_update().
+ */
+function filefield_paths_comment_update($comment) {
+  if (($ffp = filefield_paths_get_fields($comment)) !== FALSE) {
+    $update = new stdClass;
+    $update->node = FALSE;
+
+    // Process files.
+    foreach ($ffp['#files'] as &$file) {
+      // Invoke hook_filefield_paths_process_file().
+      foreach (module_implements('filefield_paths_process_file') as $module) {
+        $function = $module . '_filefield_paths_process_file';
+        $function(($file['new'] || variable_get("ffp_{$comment->node_type}_{$file['name']}", 0)), $file, $ffp['#settings'][$file['name']], $comment, $update);
+      }
+    }
+
+    field_attach_update('comment', $comment);
+  }
+}
+
+/**
  * Implementation of hook_content_fieldapi().
  */
 function filefield_paths_field_delete_field($field) {
@@ -401,7 +429,7 @@ function filefield_paths_get_fields(&$node, $op = NULL) {
   // Load fields settings
   foreach ($ffp['#types'] as $name => $temp) {
     $results = db_query("SELECT * FROM {filefield_paths} WHERE type = :type AND field = :field", array(
-      ":type" => $node->type,
+      ":type" => isset($node->type) ? $node->type : $node->node_type,
       ":field" => $name
     ));
     foreach ($results as $result) { break; }
@@ -421,7 +449,7 @@ function filefield_paths_get_fields(&$node, $op = NULL) {
  */
 function filefield_paths_filefield_paths_process_file($new, &$file, $settings, &$node, &$update) {
   if ($new) {
-    $token_data = array('file' => file_load($file['field']['fid']), 'node' => $node);
+    $token_data = array('file' => file_load($file['field']['fid']), 'node' => $node, 'comment' => $node);
 
     // Process filename.
     $file['filename']['old'] = $file['field']['filename'];
diff --git a/modules/file.inc b/modules/file.inc
index e3db7e5..16773d8 100755
--- a/modules/file.inc
+++ b/modules/file.inc
@@ -51,13 +51,7 @@ function file_filefield_paths_form_submit(&$form_state, &$ffp) {
  */
 function file_filefield_paths_get_fields(&$node, &$ffp) {
   if (is_object($node)) {
-    // TODO: Replace with field_info_fields() when http://drupal.org/node/613754 is fixed.
-    $instances = field_info_instances('node', $node->type);
-    $fields = array();
-    foreach ($instances as $field_name => $instance) {
-      $fields[$field_name] = field_info_field($field_name);
-    }
-
+    $fields = field_info_fields();
     foreach ($fields as $name => $field) {
       if ($field['type'] == 'file' && isset($node->{$field['field_name']}) && is_array($node->{$field['field_name']})) {
 
