NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_getformfile(n) 4.99.30 naviserver "NaviServer Built-in Commands"

Name

ns_getformfile - Return a tempfile for a form file field

Table Of Contents

Synopsis

Description

COMMANDs

ns_getformfile name

return the path of the temporary file uploaded via an HTML input field named name, or empty when no such file was submitted. When the input element of the file contains the HTML5 attribute multiple, a list of filenames is potentially returned.

For example, when the HTML page contains a form like the following

 <form enctype="multipart/form-data" action="url" method="post">
 First file: <input name="file1" type="file">
 Second file: <input name="file2" type="file">
 <input type="submit">
 </form>

and the form is submitted, the server access the submitted files file1 and file2 via the following snippet

 set tmpfile1 [ns_getformfile file1]
 set tmpfile2 [ns_getformfile file2]
 set fp1 [open $tmpfile1]
 ...