upload — handle a file uploaded by a client.


::rivet::upload (channel | save | data | exists | size | type | filename)


The upload command is for file upload manipulation. See the relevant Apache Directives to further configure the behavior of this Rivet feature.

::rivet::upload channel ?uploadname?
When given the name of a file upload uploadname, returns a Tcl channel that can be used to access the uploaded file.
::rivet::upload save ?uploadname? ?filename?
Saves the uploadname in the file filename.
::rivet::upload data ?uploadname?
Returns data uploaded to the server. This is binary clean - in other words, it will work even with files like images, executables, compressed files, and so on.
::rivet::upload exists ?uploadname?
Returns true if an upload named ?uploadname? exists. This can be used in scripts that are meant to be run by different forms that send over uploads that might need specific processing.
::rivet::upload size ?uploadname?
Returns the size of the file uploaded.
::rivet::upload type
If the Content-type is set, it is returned, otherwise, an empty string.
::rivet::upload filename ?uploadname?
Returns the filename on the remote host that uploaded the file.
::rivet::upload tempname ?uploadname?
Returns the name of the temporary file on the local host that the file was uploaded into.
::rivet::upload names
Returns the variable names, as a list, of all the files uploaded.

See Example 4, “File Upload”.