beautypg.com

Pcdaspfileupload – Kofax DM API User Manual

Page 65

background image

DM API O

BJECTS

45

PCDASPFileUpload

PCDASPFileUpload is a helper class/interface/object that supports the
tying of the

POST

of an ASP Multipart/Form file into a

PCDPutStream

.

(The

GET

method is not supported in PCDPutStream, so always use

POST

.) It handles all the parsing of headers from the body content and

streaming of the file that is to be uploaded into the DM

PCDPutStream

object.

The

OnStartPage

method initializes the COM interface pointers to all

of the ASP objects, such as Session, Application, Request, Response,
and Server. These are passed by the ASP engine from the interface
pointer.

The

Execute

method reads from the ASP Request object that is

obtained during

OnStartPage

. It uses the

ReadBinary

method to write

to the

PCDPutStream

object that the server supplies.

The

IsEmpty

method can be used to determine if the body of the

content is empty, which would indicate that a zero-byte file was sent.

IsEmpty

looks at the posted stream, parses out the header, and

determines if the document being sent is empty. If the content is empty,
the success return value is set to

TRUE

, and the error state is set to

PCD_ERR_ZERO_BYTE_UPLOAD

. If the body content is not empty, the

success return value is set to

FALSE

, and no error condition is set.

The

OnEndPage

method releases all the interface pointers acquired

during the

OnStartPage

initialization and resets the error state.

Example

The following is an example of creating an instance of the
PCDASPFileUpload.

.

.

.

Dim pFile As Object

.

.

.

pFile = _

Server.CreateObject("PCDClient.PCDASPFileUpload”
)