? video_upload_bugs.patch
? video_upload_bugs_with_debugging.patch
Index: video_upload.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/video/plugins/video_upload/video_upload.module,v
retrieving revision 1.9
diff -u -p -r1.9 video_upload.module
--- video_upload.module	18 Sep 2006 23:10:59 -0000	1.9
+++ video_upload.module	16 Feb 2007 15:17:07 -0000
@@ -164,20 +164,16 @@ function _video_upload_validate(&$node) 
 
 
 function _video_upload_submit(&$node) {
-  ;
+
 }
 
 
 function _video_upload_prepare(&$node) {
-  // clear video file informations
-  if(count($_POST) == 0) {
-    if (!empty($_SESSION['video_upload_file'])) {
-      file_delete($_SESSION['video_upload_file']->filepath);
-    }
+  // clear video file information that may have persisted from previous edits
+  if (count($_POST) == 0) { // i.e., this is before any information is posted to a node
     unset($_SESSION['video_upload_file']);
   }
 
-
   if ($file = file_check_upload('video_upload_file')) {
     $temppath = file_directory_temp() . '/video/';
     file_check_directory($temppath, TRUE);
@@ -193,7 +189,7 @@ function _video_upload_prepare(&$node) {
     $node->video_upload_file = $_SESSION['video_upload_file'];
     // set video size
     $node->size = $node->video_upload_file->filesize;
-
+    unset($_SESSION['video_upload_file']);
   } else {
     $_SESSION['video_upload_file'] = $node->video_upload_file;
   }
@@ -208,11 +204,11 @@ function _video_upload_store(&$node) {
       $file->fid = db_next_id('{files}_fid');
       db_query("INSERT INTO {files} (fid, nid, filename, filepath, filemime, filesize) VALUES (%d, %d, '%s', '%s', '%s', %d)", $file->fid, $node->nid, $file->filename, $file->filepath, $file->filemime, $file->filesize);
       db_query("INSERT INTO {file_revisions} (fid, vid, list, description) VALUES (%d, %d, %d, '%s')", $file->fid, $node->vid, $file->list, $file->description);
-      unset($_SESSION['video_upload_file']);
     }
     else {
       drupal_set_message(t('An error occurred during file saving. Your video file has not been stored.'), 'error');
     }
+    unset($_SESSION['video_upload_file']);
   }
 }
 
