diff --git a/apachesolr_attachments.admin.inc b/apachesolr_attachments.admin.inc
index 702b1f7..d94331c 100644
--- a/apachesolr_attachments.admin.inc
+++ b/apachesolr_attachments.admin.inc
@@ -47,6 +47,13 @@ function apachesolr_attachments_settings($form, &$form_state, $env_id) {
     '#description' => t("Extraction will be faster if run locally using tika."),
     '#default_value' => variable_get('apachesolr_attachments_extract_using', 'tika'),
   );
+  $form['apachesolr_attachments_filesize_limit'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Filesize limit (in bytes) for files to be indexed'),
+    '#size' => 80,
+    '#description' => t('If a file is larger than this limit, do not index it. Default is 40MB'),
+    '#default_value' => variable_get('apachesolr_attachments_filesize_limit', '40'),
+  );
   $form['apachesolr_attachments_tika_path'] = array(
     '#type' => 'textfield',
     '#title' => t('Tika directory path'),
@@ -81,6 +88,9 @@ function apachesolr_attachments_settings_validate($form, &$form_state) {
       form_set_error('apachesolr_attachments_tika_path', t('Tika jar file not found at this path.'));
     }
   }
+  if (!is_numeric($form_state['values']['apachesolr_attachments_filesize_limit'])) {
+    form_set_error('apachesolr_attachments_filesize_limit', t('Filesize limit must be a number.'));
+  }
 }
 
 /**
diff --git a/apachesolr_attachments.module b/apachesolr_attachments.module
index d89401c..4dbdf8c 100644
--- a/apachesolr_attachments.module
+++ b/apachesolr_attachments.module
@@ -388,6 +388,19 @@ function apachesolr_attachments_apachesolr_file_exclude($entity_id, $row, $env_i
     // Exclude
     return TRUE;
   }
+
+  // Exclude files above the configured limit.
+  $filesize_limit = variable_get('apachesolr_attachments_filesize_limit', '40');
+  // load the entity.
+  $entities = entity_load('file', array($entity_id), NULL, TRUE);
+  // Take the first item.
+  $entity = reset($entities);
+
+  // Check if the filesize is higher than the allowed filesize.
+  if (isset($entity->filesize) && $filesize_limit > 0 && $entity->filesize > $filesize_limit) {
+    return TRUE;
+  }
+
   // Do not exclude
   return FALSE;
 }
