Index: flashvideo.module
===================================================================
--- flashvideo.module	(revision 77)
+++ flashvideo.module	(revision 78)
@@ -1542,24 +1542,9 @@
       $file = (object)$file;
 
       // If they wanted to remove the file from the node.
+      // TODO: It seem this code just moveed from drupal 5 version and we does not need it in drupal 6. 
       if (!empty($file->remove)) {
-
-        // Find the files referenced by this file being removed.
-        $files = db_query("SELECT * FROM {flashvideo} fv LEFT JOIN {files} f ON f.fid=fv.fid WHERE fv.oid = %d", $file->fid);
-
-        // Delete the file record from the flashvideo tables.
-        db_query("DELETE FROM {ffmpeg_data} WHERE fid = %d", $file->fid);
-        db_query("DELETE FROM {flashvideo} WHERE oid = %d", $file->fid);
-
-        // Iterate through all the files removed from the node.
-        while ($oldfile = db_fetch_object($files)) {
-
-          // Delete that file from the files and upload tables as well as from the file system.
-          db_query("DELETE FROM {files} WHERE fid = %d", $oldfile->fid);
-          db_query("DELETE FROM {upload} WHERE fid = %d", $oldfile->fid);
-          file_delete($oldfile->filepath);
-          module_invoke_all('flashvideo_delete_file', $oldfile, $node->type);
-        }
+          flashvideo_file_delete($file);
       }
       else {
 
@@ -1603,6 +1588,26 @@
   }
 }
 
+function flashvideo_file_delete($file) {
+  // Find the files referenced by this file being removed.
+  $files = db_query("SELECT * FROM {flashvideo} fv LEFT JOIN {files} f ON f.fid=fv.fid WHERE fv.oid = %d", $file->fid);
+
+  // Delete the file record from the flashvideo tables.
+  db_query("DELETE FROM {ffmpeg_data} WHERE fid = %d", $file->fid);
+  db_query("DELETE FROM {flashvideo} WHERE oid = %d", $file->fid);
+
+  // Iterate through all the files removed from the node.
+  while ($oldfile = db_fetch_object($files)) {
+
+    // Delete that file from the files and upload tables as well as from the file system.
+    db_query("DELETE FROM {files} WHERE fid = %d", $oldfile->fid);
+    db_query("DELETE FROM {upload} WHERE fid = %d", $oldfile->fid);
+    file_delete($oldfile->filepath);
+    module_invoke_all('flashvideo_delete_file', $oldfile, $node->type);
+  }
+
+}
+
 /**
  *  This function will search for a filepath, trying several commons paths.
  *