Uploading a File from Windows to iSeries IFS

LANSA

Uploading a File from Windows to iSeries IFS
Example 181B - Rating: specific
The Things that Make Up this ExampleTo Execute this Example

This is an example of one way you can upload a file from your desktop to the IFS file system on your iSeries. It runs only with IBM’s HTTP server, not with I/NET’s.





Notes and suggestions

This example uses a 3GL program written in C language code called SET181UPLO. Some important points to understand about it:
  • During the import of the SET material the program is restored into partition module library.
  • You can leave it there or place it in any library of your choice as long as you add the proper directives to your http configuration file. Please refer to the section To Execute later in this document.
  • This program is nominated in the ACTION= attribute of the FORM tag in the HTML of SET181B. As such, it is the program that will process the data on the iSeries server. So if for a normal LANSA for the WEB function the ACTION attribute would look like this: ACTION="/<RDML MERGE="&CGI">/LANSAWEB?WEBEVENT+<RDML MERGE="&SESSPL">. For this example it looks like this: ACTION="/cgi-bin/set181uplo"
  • Additionally, for file uploads the FORM tag also requires the ENCTYPE attribute to specify the data encryption type. In this case: ENCTYPE="multipart/form-data"
  • SET181UPLO uses 3 important values:
IFS root path The files selected with the Browse button will be uploaded to the root path /TMP in your IFS. /TMP should exist in all configurations. Any subdirectory you specify on the browser is assumed to be a subdirectory of /TMP and must exist at the time of execution.
To change /TMP to another root path of your choice, edit SET181UPLO and replace the only occurrence of /TMP. Note that the root path specified must not have a / (forward slash) at the end of it.

Maximum aggregate size of the file(s) to upload (in bytes)It has been set to 4000000 bytes (approx. 4mb).

To change it to another value, edit SET181UPLO and replace the only occurrence of 4000000.


IFS ASCII CCSID It has been set to 819.

To change it to another value, edit SET181UPLO and replace the only occurrence of 819.




  • SET181UPLO must be recompiled after any changes made to it. To recompile execute this command: CRTBNDC PGM(<your library>/SET181UPLO) SYSIFCOPT(*IFSIO)
Keywords
UploadIFS
Example 181B