View Single Post
Old 05-06-2004, 05:13 PM  
neoxed
Too much time...
 
Join Date: May 2003
Posts: 1,326
Default

Quote:
Originally posted by Ofloo
as in reading my mind isn't that hard pre stor and file rename ..
No, If you read my original statement I was referring to your code not your idea.

Quote:
Originally posted by Ofloo
i tryed with and without mapping string or regsub if u prefer i prefer string map its faster and does same thing
Well if you read the TCL documentation, regsub and string map have very different uses. Regsub is used for regular expression substitutions and string map simply replaces one or several characters in a given string.

In your sample code, you should be using "lrange $arg 1 end" rather then "lindex $arg end". If someone uploaded a file that contained a space, your script would fail.

PHP Code:
if {[file exists $path\\[lindex $arg end].incomplete]} {
    
file rename -- $path\\[lindex $arg end].incomplete $path\\[lindex $arg end]
    
iputs -nobuffer "$path\\[lindex $arg end].incomplete $path\\[lindex $arg end]"

On "pre stor" events, the file doesn't exist yet. So the [file exists ...] is meaningless. Thus why your file is not being renamed. Try using "post stor" if wasn't so lazy at the moment, I would try myself.
neoxed is offline