I am having trouble with uploading files (the form var for the
uploaded file is upload_file):
Error: could not read "": no such file or directory
could not read "": no such file or directory
while executing
"file size $tmp_filename"
invoked from within
"if { ![info exists upload_file] || [empty_string_p $upload_file] } {
append exception_text "<li>Please specify a file to
upload
"
incr except..."
Here's the actual code snippet...
if { ![info exists upload_file] || [empty_string_p $upload_file] } {
append exception_text "<li>Please specify a file to
upload
"
incr exception_count
} else {
# this stuff only makes sense to do if we know the file exists
# ns_queryget:
# http://www.aolserver.com/docs/tcldev/tapi-c98.htm#191488
set tmp_filename [ns_queryget upload_file.tmpfile]
set file_extension [string tolower [file extension $upload_file]]
# remove the first . from the file extension
regsub "." $file_extension "" file_extension
set guessed_file_type [ns_guesstype $upload_file]
set n_bytes [file size $tmp_filename]
The ns_queryget doc says...
set x [ns_queryget name]
If "name" is a key in the query data, the variable x will be set to
the value associated with the "name" key. If "name" is not a key in
the query data, "" will be returned.
It appears that
set tmp_filename [ns_queryget upload_file.tmpfile]
is setting tmp_filename to "" suggesting that upload_file.tmpfile "is
not a key in the query data."
I lifted most of the code from /pvt/portrait/upload-2.tcl. What am
I missing? -- Thanks.