Top
NetCOBOL V11.0 CGI Subroutines User's Guide
FUJITSU Software

3.10.1 COBW3_GET_UPLOADFILE_INFO,COBW3_GET_UPLOADFILE_INFO_X and COBW3_GET_UPLOADFILE_INFO_N

These subroutines acquire the information regarding an uploaded file. Details of these subroutines are as follows:

ASCII environment

COBW3_GET_UPLOADFILE_INFO

Retrieves the name of an uploaded file (alphanumeric character string specified in NAME), and acquires information about an uploaded file.

Unicode environment

COBW3_GET_UPLOADFILE_INFO_X

Retrieves the name of an uploaded file (alphanumeric character string specified in NAME), and acquires the information about an uploaded file.

COBW3_GET_UPLOADFILE_INFO_N

Retrieves the name of an uploaded file (national language character strings specified in NAME), and acquires the information about the found uploaded file.

How to write

CALL "COBW3_GET_UPLOADFILE_INFO" USING COBW3.
CALL "COBW3_GET_UPLOADFILE_INFO_X" USING COBW3.
CALL "COBW3_GET_UPLOADFILE_INFO_N" USING COBW3.

Data setting for calling

COBW3-SEARCH-DATA and COBW3-SEARCH-DATA-N

Set the name (NAME) of the upload file to be retrieved (The name specified in "name" of the HTML document (Web page for invoking application) must be set instead of the file name).

For COBW3_GET_UPLOADFILE_INFO and COBW3_GET_UPLOADFILE_INFO_X, set the name to COBW3-SEARCH-DATA.

For COBW3_GET_UPLOADFILE_INFO_N, set the name to COBW3-SEARCH-DATA-N.

COBW3-SEARCH-LENGTH [optional]

If the name (NAME) has a valid blank at the end, set the string length (byte length) of the name including the blank.

Value

Meaning

0

Searches the upload file name using the length up to the last character excluding the blank. However, if COBW3-SEARCH-DATA or COBW3-SEARCH-DATA-N is completely blank, the string length is set to zero for processing.

1 to 1024

Searches the upload file name using the specified string length.

COBW3-NUMBER [optional]

If multiple entities with the same name (NAME) exist in Web parameters, set the order of appearance of names to be searched.

Condition name

Value

Meaning

COBW3-NUMBER-INIT

1

Searches the name that matches first.

-

2 to 9999

Searches the names in the specified order of appearance.

Processing result data:

COBW3-SEARCH-FLAG

Condition name

Value

Meaning

COBW3-SEARCH-FLAG-NON

"0"

The name to be searched does not exist, or size of the uploaded file is 0.

COBW3-SEARCH-FLAG-EXIST

"1"

The name to be searched exists.

COBW3-UPLD-CL-FILE-PATH

Sets the path name of the upload file in the client that corresponds to the retrieved name (NAME).

COBW3-UPLD-CL-FILE-PATH-LENGTH

Sets the character string length (byte length) of the path name of the upload file in the client that corresponds to the retrieved name (NAME).

COBW3-UPLD-CL-FILE-NAME

Sets the file name of the upload file in the client that corresponds to the retrieved name (NAME).

COBW3-UPLD-CL-FILE-NAME-LENGTH

Sets the character string length (byte length) of the file name of the upload file in the client that corresponds to the retrieved name (NAME).

COBW3-UPLD-CONTENT-TYPE

Sets the character string that indicates the Content-type of the upload file that corresponds to the retrieved name (NAME).

COBW3-UPLD-CONTENT-TYPE-LENGTH

Sets the character string length (byte length) of the character string that indicates the content type of the upload file that corresponds to the retrieved name (NAME).

COBW3-UPLD-FILE-SIZE

Sets the uploaded file size (byte length).

Note

When "\" is included in the uploaded file name when the client is UNIX, the file name and the path name cannot be correctly received.

Example

[c.htm (Web page for invoking application)]

         :
  <FORM METHOD="POST" ENCTYPE="multipart/form-data"
        ACTION="sample/action.script">
  <P>
  Your Name:<INPUT TYPE="text" NAME="NAME1"><BR>
  Send file 1:<INPUT TYPE="file" NAME="FILE1"><BR>
  <INPUT TYPE="submit" VALUE="Send">
  <INPUT TYPE="reset" VALUE="Reset">
  </FORM>
                   : 

[COBOL source program]

       :
* Name setup
      MOVE "FILE1" TO COBW3-SEARCH-DATA.
* Acquisition of upload file information
      CALL "COBW3_GET_UPLOADFILE_INFO_X" USING COBW3.
       :
      IF COBW3-SEARCH-FLAG-EXIST THEN
* Setup of name of file to be generated
        MOVE "d.tmp"  TO COBW3-UPLOADED-FILENAME
* File generation
        CALL "COBW3_GEN_UPLOADFILE_X" USING COBW3
       :
* File data processing
       :
* Deletion of generated file
        CALL "COBW3_DEL_UPLOADEDFILE" USING COBW3
      END-IF.
               :