InboundMultiPart

The InboundMultiPart handler is used to send and receive MIME multipart content.

Refer to 5.1.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.
#JSMMSG field is set to the uploaded filename.

INDEX

value

Conditional. Index number of Multipart to save.
The index starts from 0.

ENCODING

 

Optional. See ENCODING.
Used to convert field values.

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.

Example

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:

1.  The working list argument is used to create a MIME MultiPart response.

2.  The name value pair data and the file data are passed using a list argument.

3.  An optional fourth field controls how the file contents are MIME encoded. Possible values are 8bit or base64. The default MIME encoding is 8bit. The MIME body part Content-Type is determined by the file extension using the Java Activation Framework.

The field value encoding is determined by the ENCODING keyword.

Example

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)')

 

Syntax:

Command

Keyword

Value

Developer notes

SEND

HANDLER

InboundMultiPart

 

STATUS

value

Optional: HTTP status number.
Default: 200.

MESSAGE

value

Optional: HTTP status message.
Default: OK.

UAPATH

value

Optional. User agent save response path.

UAFILE

value

Optional. User agent save response filename.

UACACHE

value

Optional. Cache-Control max-age.
Default is 0.

UADISPOSITION

value

Optional. Content-Disposition filename.

ENCODING

 

Optional. See ENCODING.
Used to encode field values.

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.

 

Example

SEND HANDLER(InboundMultiPart) #WRKLST(TYPE,NAME,VALUE)