Index: openacs-4/packages/acs-templating/tcl/file-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/file-procs.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/acs-templating/tcl/file-procs.tcl 1 Oct 2017 12:16:05 -0000 1.12 +++ openacs-4/packages/acs-templating/tcl/file-procs.tcl 5 Jul 2019 17:16:33 -0000 1.12.2.1 @@ -15,24 +15,48 @@ @return the list { file_name temp_file_name content_mime_type }. } { upvar $element_ref element - return [list [template::util::file_transform $element(id)]] + return [template::util::file_transform $element(id)] } ad_proc -public template::util::file_transform { element_id } { - Helper proc, which gets AOLserver's variables from the query/form, and returns it as a 'file' datatype value. + + Helper proc, which gets AOLserver/NaviServer's variables from the + query/form, and returns it as a 'file' datatype value. + @return the list { file_name temp_file_name content_mime_type }. -} { - # Work around Windows bullshit - set filename [ns_queryget $element_id] - if {$filename eq ""} { +} { + # + # Get the files information using 'ns_querygetall' and return it in a list + # per file + # + set files [list] + set filenames [ns_querygetall $element_id] + # + # No files, get out + # + if {$filenames eq ""} { return "" } + set tmpfiles [ns_querygetall $element_id.tmpfile] + set types [ns_querygetall $element_id.content-type] + for {set file 0} {$file < [llength $filenames]} {incr file} { + set filename [lindex $filenames $file] + set tmpfile [lindex $tmpfiles $file] + set type [lindex $types $file] + # + # Cleanup filenames + # + regsub -all {\\+} $filename {/} filename + regsub -all { +} $filename {_} filename + set filename [lindex [split $filename "/"] end] + # + # Append to the list of lists + # + lappend files [list $filename $tmpfile $type] + } - regsub -all {\\+} $filename {/} filename - regsub -all { +} $filename {_} filename - set filename [lindex [split $filename "/"] end] - return [list $filename [ns_queryget $element_id.tmpfile] [ns_queryget $element_id.content-type]] + return $files } Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v diff -u -r1.63.2.5 -r1.63.2.6 --- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 5 Jul 2019 10:57:11 -0000 1.63.2.5 +++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 5 Jul 2019 17:16:33 -0000 1.63.2.6 @@ -469,6 +469,8 @@ } { Generate a file widget. + @see template::util::file_transform + @param element_reference Reference variable to the form element @param tag_attributes HTML attributes to add to the tag