Difference between revisions of "Ns getformfile"

From AOLserver Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
 
'''NAME'''
 
'''NAME'''
  
Line 10: Line 9:
 
'''DESCRIPTION'''
 
'''DESCRIPTION'''
  
# Briefly, use:
+
: Briefly, use:
#
+
 
# <form enctype="multipart/form-data" action="url" method=post>
+
<form enctype="multipart/form-data" action="url" method=post>
# First file: <input name="file1" type="file">
+
First file: <input name="file1" type="file">
# Second file: <input name="file2" type="file">
+
Second file: <input name="file2" type="file">
# <input type="submit">
+
<input type="submit">
# </form>
+
</form>
#
+
 
# and then access with:
+
: and then access with:
#
+
 
# set tmpfile1 [ns_getformfile file1]
+
set tmpfile1 [ns_getformfile file1]
# set tmpfile2 [ns_getformfile file2]
+
set tmpfile2 [ns_getformfile file2]
# set fp1 [open $tmpfile1]
+
set fp1 [open $tmpfile1]
# set fp2 [open $tmpfile2]
+
set fp2 [open $tmpfile2]
#
+
 
# Temp files created by ns_getform are removed when the connection closes.
+
: Temp files created by [[ns_getform]] (which is called by ns_getformfile) are removed when the connection closes.
#
 

Revision as of 01:39, 11 October 2009

NAME

ns_getformfile - Return a tempfile for a form file field.

SYNOPSIS

ns_getformfile fileUploadFormFieldName

DESCRIPTION

Briefly, use:

<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 then access with:

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

Temp files created by ns_getform (which is called by ns_getformfile) are removed when the connection closes.