C source file SET181UPLO can be changed to upload files into the IFS using Apache

Date:16 March 2005
Product/Release:LANSA for the Web
Abstract:Some changes in the C source file in SET181UPLO allows to upload files into the IFS with Apache Web Server
Submitted By:LANSA Technical Support
Last Review:November 2010

Using the SET EXAMPLE 181B you can process files to upload into the IFS on iSeries.

This example has been available for the use with HTTP Web Server only.

However you can make certain changes in the SET181UPLO C source file to allow this SET example to work when using an APACHE Web Server.

Method:

To upload files into IFS using this SET example you need to change the following C code in SET181UPLO:

  1. In SET181UPLO C source, there is:

    envVariable = getenv ( "CONTENT_TYPE" ) ;
    if ( strcmp ( envVariable, "multipart/form-data" ) != 0 )
    {
    sendResponse ( "Content type is not multipart/form-data" ) ;
    return ;
    }

     
    Modify these lines to be comments because Apache Server uses the value for envVariable as :
    "multipart/form-data; boundary=---------------------------7d4148e19043e"
    It does not use "multipart/form-data" like the original IBM Http server. 
     
  2. Also comment out those lines of codes which has this defined:

    printf ( "HTTP/1.0 200 OK\n" ) ;

    The full content of this C source file is documented in the SET collection.

    Making these changes will allow you to run the example successfully when using APACHE as the Web server.