diff --git a/src/Form/FileEditForm.php b/src/Form/FileEditForm.php
index b0eb94b..a9c77aa 100644
--- a/src/Form/FileEditForm.php
+++ b/src/Form/FileEditForm.php
@@ -52,7 +52,7 @@ public function form(array $form, FormStateInterface $form_state) {
         // Set up replacement file validation.
         $replacement_options = array();
         // Replacement file must have the same extension as the original file.
-        $replacement_options['file_extensions'] = pathinfo($file->getFilename(), PATHINFO_EXTENSION);
+        $replacement_options['file_extensions'] = pathinfo($file->getFileUri(), PATHINFO_EXTENSION);
 
         $form['replace_upload'] = array(
           '#type' => 'managed_file',
