Fix for previous commit to work when uploading encrypted files to couchdb
authorbradymiller <bradymiller@users.sourceforge.net>
Wed, 7 Nov 2012 03:07:31 +0000 (6 19:07 -0800)
committerbradymiller <bradymiller@users.sourceforge.net>
Wed, 7 Nov 2012 03:07:31 +0000 (6 19:07 -0800)
controllers/C_Document.class.php

index c032eab..b5d4049 100644 (file)
@@ -122,11 +122,12 @@ class C_Document extends Controller {
                                                $tmpfile = fopen( $_FILES['file']['tmp_name'][$key] , "r" );
                                                $filetext = fread( $tmpfile, $_FILES['file']['size'][$key]  );
                                                $plaintext = $this->decrypt( $filetext, $passphrase );
+                                                fclose($tmpfile);
                                                unlink( $_FILES['file']['tmp_name'][$key] );
                                                $tmpfile = fopen( $_FILES['file']['tmp_name'][$key], "w+" );
                                                fwrite( $tmpfile, $plaintext );
                                                fclose( $tmpfile );
-                                               $_FILES['file']['size'][$key] = filesize( $tmpfilepath.$tmpfilename );
+                                               $_FILES['file']['size'][$key] = filesize( $_FILES['file']['tmp_name'][$key] );
                                        }
                                        
                                        $docid = '';