The InboundMultiPart handler is used to send and receive MIME multipart content.
Refer to 5.2.6 Web Browser Content.
Command | Keyword | Value | Developer notes |
|---|---|---|---|
RECEIVE | HANDLER | InboundMultiPart | |
FILE | value | Conditional. Name of INPUT tag. | |
FIELD | value | Conditional. Name of INPUT tag. | |
FILENAME | value | Conditional. Name of INPUT tag. | |
INDEX | value | Conditional. Index number of Multipart to save. | |
ENCODING | Optional. See ENCODING. | ||
NUMBERFORMAT | Optional. See NUMBERFORMAT. | ||
TO | value | Conditional. File path to receive content. | |
APPEND | *YES | Optional. Append content to existing file. | |
*NO | Default. |
A web browser can send content using the multipart/form-data format.
<FORM METHOD="POST" ACTION="http://server1/cgi-bin/jsmdirect?upload" ENCTYPE="multipart/form-data">
<INPUT NAME="COMPANY" TYPE="TEXT" SIZE ="30"/>
<INPUT NAME="FILE1" TYPE="FILE" SIZE ="60"/>
<INPUT NAME="FILE2" TYPE="FILE" SIZE ="60"/>
<INPUT NAME="FILE3" TYPE="FILE" SIZE ="60"/>
<INPUT TYPE="SUBMIT" VALUE="Send order"/>
</FORM>
If the specified FILE, FIELD, FILENAME or INDEX component does not exist then a command status of NOT_EXIST is returned.
If the FILE component does exist but has not been used, then NOT_EXIST is also returned.
Receive content from a Web browser post.
RECEIVE HANDLER(InboundMultiPart) FIELD(COMPANY)
RECEIVE HANDLER(InboundMultiPart) FIELD(COMPANY) ENCODING(MS932)
In the following example the file selected as FILE2 is uploaded to the location and new name given in TO parameter.
RECEIVE HANDLER(InboundMultiPart) FILE(FILE2) TO(/folder/file.jpeg)
In this example, it is the name of the FILE2 (i.e. C:\images\holiday.jpeg) selected in the browser that is passed to the LANSA function (i.e. holiday.jpeg).
RECEIVE HANDLER(InboundMultiPart) FILENAME(FILE2)
When the SEND command of this content handler is executed the following steps occur:
The first field of the list contains the component's content type of FIELD or FILE.
The second field contains the component's name.
The third field contains the component value or the component file path.
The field value encoding is determined by the ENCODING keyword.
DEFINE FIELD(#TYPE) TYPE(*CHAR) LENGTH(10)
DEFINE FIELD(#NAME) TYPE(*CHAR) LENGTH(20)
DEFINE FIELD(#VALUE) TYPE(*CHAR) LENGTH(100)
DEF_LIST NAME(#WRKLST) FIELDS(#TYPE #NAME #VALUE) TYPE(*WORKING)
CHANGE FIELD(#TYPE) TO(FIELD)
CHANGE FIELD(#NAME) TO(COMPANY)
CHANGE FIELD(#VALUE) TO(ACME)
ADD_ENTRY TO_LIST(#WRKLST)
CHANGE FIELD(#TYPE) TO(FILE)
CHANGE FIELD(#NAME) TO(ORDER_FILE)
CHANGE FIELD(#VALUE) TO('''/order/month-order.xml''')
ADD_ENTRY TO_LIST(#WRKLST)
CHANGE FIELD(#JSMCMD) TO('SEND HANDLER(InboundMultiPart) SERVICE_LIST(TYPE,NAME,VALUE)')
Command | Keyword | Value | Developer notes |
|---|---|---|---|
SEND | HANDLER | InboundMultiPart | |
STATUS | value | Optional: HTTP status number. | |
MESSAGE | value | Optional: HTTP status message. | |
UAPATH | value | Optional. User agent save response path. | |
UAFILE | value | Optional. User agent save response filename. | |
UACACHE | value | Optional. Cache-Control max-age. | |
UADISPOSITION | value | Optional. Content-Disposition filename. | |
ENCODING | Optional. See ENCODING. | ||
NUMBERFORMAT | Optional. See NUMBERFORMAT. | ||
CHARSET | *YES | Optional. Include charset attribute. | |
*NO | Do not include charset attribute. | ||
*TEXT | Default. Include charset attribute if content is text. |
SEND HANDLER(InboundMultiPart) #WRKLST(TYPE,NAME,VALUE)