4D v16.3WEB GET BODY PART |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
WEB GET BODY PART
WEB GET BODY PART
The WEB GET BODY PART command, when called in the context of a Web process, parses the "body" part of a multi-part request. In the part parameter, pass the number of the part to be parsed. You can get the total number of parts using the WEB Get body part count command. The contents parameter receives the contents of the part. When the parts to be retrieved are files, you must pass a BLOB type parameter. In the case of TEXT variables submitted in a Web form, you can pass a Text type parameter. The name parameter receives the variable name of the HTTP input field. The mimeType and name parameters receive the Mime type and the name of the original file, if any. A name is only received when the file was submitted as <input type="file">. Note: In the context of a multi-part request, the first array of the WEB GET VARIABLES command returns all parts of the form, in the same order as the WEB GET BODY PART command. You can use it in order to get the position of the parts of the form directly. In this example, a Web form downloads several pictures using a browser onto the HTTP server and displays them in the page. Here is the Web form: Here is the code for the <body> part of the page: <body> <form enctype="multipart/form-data" action="/4DACTION/GetFile/" method="post"> Locate the picture files to upload: <br> Picture file 1: <input name="file1" type="file"><br> Picture file 2: <input name="file2" type="file"><br> <input type="submit"> </form> <hr/> <!--4DSCRIPT/galleryInit--> <!--4Dloop aFileNames--> <img src="/photos/<!--4Dvar aFileNames{aFileNames}-->"/> <!--4Dendloop--> </body> Two 4D methods are called by the page:
Here is the code for galleryInit: C_TEXT($vDestinationFolder) Here is the code for GetFile: C_TEXT($vPartName;$vPartMimeType;$vPartFileName;$vDestinationFolder)
See also
Binding 4D objects with HTML objects
|
PROPERTIES
Product: 4D HISTORY
Created: 4D v13 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||