blob: 8bd2a7e88a91a8994bded3ec04d66db395fbcd53 [file] [log] [blame]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>upload</title><link rel="stylesheet" type="text/css" href="rivet.css"><meta name="generator" content="DocBook XSL Stylesheets V1.79.1"><link rel="home" href="index.html" title="Apache Rivet 3.0"><link rel="up" href="commands.html" title="Rivet Tcl Commands and Variables"><link rel="prev" href="unescape_string.html" title="unescape_string"><link rel="next" href="url_script.html" title="url_script"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">upload</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="unescape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><th width="60%" align="center">Rivet Tcl Commands and Variables</th><td width="20%" align="right"> <a accesskey="n" href="url_script.html"><img src="images/next.png" alt="Next"></a></td></tr></table></div><div class="refentry"><div class="refentry.separator"><hr></div><a name="upload"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>upload — handle a file uploaded by a client.</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> (<span style="font-family:monospace; font-weight: bold;">channel</span> | <span style="font-family:monospace; font-weight: bold;">save</span> | <span style="font-family:monospace; font-weight: bold;">data</span> | <span style="font-family:monospace; font-weight: bold;">exists</span> | <span style="font-family:monospace; font-weight: bold;">size</span> | <span style="font-family:monospace; font-weight: bold;">type</span> | <span style="font-family:monospace; font-weight: bold;">filename</span>)</div></div></div><div class="refsect1"><a name="idm45384560108656"></a><h2>Description</h2><p style="width:90%">
The upload command is for file upload manipulation.
See the relevant Apache Directives to further configure the
behavior of this Rivet feature.
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">channel</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
When given the name of a file upload
<em class="replaceable"><code>uploadname</code></em>,
returns a Tcl channel that can be used to access the
uploaded file.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">save</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>? ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>filename</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Saves the <em class="replaceable"><code>uploadname</code></em> in
the file <em class="replaceable"><code>filename</code></em>.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">data</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
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.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">exists</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Returns true if an upload named ?<span style="font-family:monospace; font-weight: bold;">uploadname</span>?
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.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">size</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Returns the size of the file uploaded.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">type</span> </div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
If the <code class="varname">Content-type</code> is set, it is
returned, otherwise, an empty string.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">filename</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Returns the filename on the remote host that uploaded the file.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">tempname</span> ?<span style="font-family:monospace; font-weight: bold;"><em class="replaceable"><code>uploadname</code></em></span>?</div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Returns the name of the temporary file on the local host that the file was uploaded into.
</div></div></dd><dt><span class="term">
<div class="cmdsynopsis" style="width:80%"><div style="border: 1px solid #282; margin:1ex ; padding:.4ex; padding-left: 0.8ex; word-spacing:1ex "><span style="font-weight:bold ; font-family:monospace">::rivet::upload</span> <span style="font-family:monospace; font-weight: bold;">names</span> </div></div>
</span></dt><dd><div style="padding:4 ; margin-top:3 ; margin-bottom:3 ; width:75%"><div style="margin-bottom:1.5ex ; padding .5ex">
Returns the variable names, as a list, of all the files uploaded.
</div></div></dd></dl></div><p style="width:90%">
See <a class="xref" href="examples.html#file_upload" title="Example 4. File Upload">Example 4, “File Upload”</a>.
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="unescape_string.html"><img src="images/prev.png" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="commands.html"><img src="images/up.png" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="url_script.html"><img src="images/next.png" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">unescape_string </td><td width="20%" align="center"><a accesskey="h" href="index.html"><img src="images/home.png" alt="Home"></a></td><td width="40%" align="right" valign="top"> url_script</td></tr></table></div></body></html>