Index: ftp.tcl
===================================================================
RCS file: /cvsroot/tcllib/tcllib/modules/ftp/ftp.tcl,v
retrieving revision 1.44
diff -u -r1.44 ftp.tcl
--- ftp.tcl	23 Oct 2006 19:29:08 -0000	1.44
+++ ftp.tcl	9 Nov 2006 08:52:04 -0000
@@ -43,6 +43,7 @@
 # State           Current state of the session and the currently executing command.
 # RemoteFileName  Name of the remote file, for put/get
 # LocalFileName   Name of local file, for put/get
+# temp            1 - Put is in temporary mode (i.e. use the STOT command)
 # inline          1 - Put/Get is inline (from data, to variable)
 # filebuffer  
 # PutData         Data to move when inline
@@ -728,16 +729,26 @@
         put_open {
             switch -exact -- $rc {
                 1 -
-		2 {
+                2 {
                     if { [string equal $ftp(Mode) "passive"] } {
                         if { ![OpenPassiveConn $s $buffer] } {
                             set errmsg "Error setting PASSIVE mode!"
                             set complete_with 0
-			    Command $ftp(Command) error $errmsg
+                            Command $ftp(Command) error $errmsg
                         }
-                    } 
-                    PutsCtrlSock $s "STOR $ftp(RemoteFilename)"
-                    set ftp(State) put_sent
+                    }
+                    if {$ftp(temp) == 1} {
+                        PutsCtrlSock $s "STOT"
+                        set ftp(State) put_sent
+                    } else {
+                        if {$ftp(RemoteFilename) eq ""} {
+                            PutsCtrlSock $s "STOU"
+                            set ftp(State) put_sent
+                        } else {
+                            PutsCtrlSock $s "STOR $ftp(RemoteFilename)"
+                            set ftp(State) put_sent
+                        }
+                    }
                 }
                 default {
                     if { [string equal $ftp(Mode) "passive"] } {
@@ -1716,6 +1727,7 @@
     }
 
     set ftp(inline) 0
+    set ftp(temp) 0
     set flags 1
     set source ""
     set dest ""
@@ -1727,6 +1739,8 @@
             set ftp(filebuffer) ""
         } elseif {($flags) && ([string equal $arg "-channel"])} {
             set ftp(inline) 2
+        } elseif {($flags) && ([string equal $arg "-temp"])} {
+            set ftp(temp) 1
 	} elseif {$source == ""} {
             set source $arg
 	} elseif {$dest == ""} {
@@ -1746,9 +1760,6 @@
 
     if {$ftp(inline) == 1} {
         set ftp(PutData) $source
-        if { $dest == "" } {
-            set dest ftp.tmp
-        }
         set ftp(RemoteFilename) $dest
     } else {
 	if {$ftp(inline) == 0} {
