Difference between revisions of "Ns getform"
Jump to navigation
Jump to search
(imported from WiKit id 566) |
(Undo revision 5683 by Adrianjackson21 (Talk)) |
||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | Man page: http://aolserver.com/docs/tcl/ns_getform.html | + | Man page: http://aolserver.com/docs/tcl/ns_getform.html |
− | |||
---- | ---- | ||
'''NAME''' | '''NAME''' | ||
− | : ns_getform - Return | + | : ns_getform - Return the connection formdata ns_set, copying multipart form data into temp files if necessary. |
'''SYNOPSIS''' | '''SYNOPSIS''' | ||
− | : '''ns_getform''' | + | : '''ns_getform''' ''?charset?'' |
'''DESCRIPTION''' | '''DESCRIPTION''' | ||
− | : This | + | : This is a Tcl wrapper to '''[[ns_conn]] form''' that first calls [[ns_urlcharset]] if ''charset'' is specified. In addition, if the request contains multipart form submission, it copies each uploaded file content into a temp file and sets up data to allow access to these temp files using [[ns_getformfile]]. Otherwise, it generally behaves the same as ns_conn form, so see its documentation for more details. |
+ | |||
+ | : Use this for multipart/form-data POST requests. It will append the ns_conn form ns_set with additional keys - two for each uploaded file. These are ''fileUploadFormFieldName''.'''content-type''', which is the content type as specified by the client, followed by ''fileUploadFormFieldName''.'''tmpfile''', which is the location of a temporary file containing the transmitted file content. The temporary file name is generated by [[ns_tmpnam]] and a script registered by [[ns_atclose]] deletes the temporary file when the connection is closed. | ||
+ | |||
+ | '''NOTES''' | ||
+ | : Here is one way to prevent the processing of large files: | ||
+ | |||
+ | set content_length [ns_set iget [ns_conn headers] content-length] | ||
+ | if {$content_length eq "" || $content_length > 1000000} { | ||
+ | # return some error message about file too big | ||
+ | } | ||
+ | |||
+ | ''What happens if the client sends a false Content-Length: header?'' | ||
− | + | ''Is there a way to limit the size of an incoming POST before the files are saved to the file system?'' | |
− | + | See [[Annotated AOLserver Configuration Reference]] | |
+ | ns_param maxinput [expr 5 * 1024 * 1024] ;# Maximum file size for uploads in bytes, default is 1MB, new in AOLserver 4.01 | ||
'''SEE ALSO''' | '''SEE ALSO''' | ||
Line 26: | Line 38: | ||
---- | ---- | ||
− | [[Category Documentation]] - [[Category Core Tcl API]] | + | [[Category:Documentation]] - [[Category:Core Tcl API]] |
Latest revision as of 16:11, 3 March 2010
Man page: http://aolserver.com/docs/tcl/ns_getform.html
NAME
- ns_getform - Return the connection formdata ns_set, copying multipart form data into temp files if necessary.
SYNOPSIS
- ns_getform ?charset?
DESCRIPTION
- This is a Tcl wrapper to ns_conn form that first calls ns_urlcharset if charset is specified. In addition, if the request contains multipart form submission, it copies each uploaded file content into a temp file and sets up data to allow access to these temp files using ns_getformfile. Otherwise, it generally behaves the same as ns_conn form, so see its documentation for more details.
- Use this for multipart/form-data POST requests. It will append the ns_conn form ns_set with additional keys - two for each uploaded file. These are fileUploadFormFieldName.content-type, which is the content type as specified by the client, followed by fileUploadFormFieldName.tmpfile, which is the location of a temporary file containing the transmitted file content. The temporary file name is generated by ns_tmpnam and a script registered by ns_atclose deletes the temporary file when the connection is closed.
NOTES
- Here is one way to prevent the processing of large files:
set content_length [ns_set iget [ns_conn headers] content-length] if {$content_length eq "" || $content_length > 1000000} { # return some error message about file too big }
What happens if the client sends a false Content-Length: header?
Is there a way to limit the size of an incoming POST before the files are saved to the file system?
See Annotated AOLserver Configuration Reference
ns_param maxinput [expr 5 * 1024 * 1024] ;# Maximum file size for uploads in bytes, default is 1MB, new in AOLserver 4.01
SEE ALSO
-