n upload contains information about file or files uploaded via the client browser.
Variable |
Value/meaning |
Access |
upload%[index&]name:name upload%[index&]name:type upload%[index&]name:size upload%[index&]name:uploaded |
The name of the uploaded file The type of the uploaded file The size of the uploaded file non-zero if the file has been uploaded |
get |
upload%[index&]name:saveas |
The name of the file to be saved on the server side. Uploaded files are held only temporarily until the end of the page run. To "actualise" the uploaded file, the "saveas" element must be set to a valid server file name (which is in FileDir – {sys%croft:filedir}, or {sys%croft:wwwdir} or {sys%croft:textdir} provided the full path is specified). |
get set |
Note: index& is used only for array input (e.g. <input type=file name="clientfile[]">). The first file is represented as "upload%0&clientfile" and the second "upload%1&clientfile" and so on.
A typical upload form is like:
<form method=post enctype="multipart/form-data" action="save.htm">
<input type=file name="clientfile">
<input type=submit value=Upload>
</form>
In the above example, "save.htm" will do var upload%clientfile:saveas = "serverfile"; to save the uploaded file into "serverfile" on the server storage. The status of the "saveas" operation is in variables status%upload and message%upload.
|