upload response (Rich UI only)
Provides feedback to the application on a file upload transaction.
Promptable? NO
Possible Values: data structure response field
Bindable? YES
Products: ProfoundUIÂ
This property is bound to a data structure response field which provides the following information to the application after a file upload transaction:
How many files were uploaded.
The directory files were uploaded to.
The name of each uploaded file.
The size of the response field must be calculated as follows:
256(n + 1) + 3
Where "n" is the maximum number of files that can be uploaded, as specified in the "number of files" property. For example, if the widget is configured to allow for 10 files, then the response field length should be given as 2819.
The data structure should be defined in the application as follows:
Â
Fixed Format
D UPLOADINFO DS Qualified
D NumFiles 3S 0
D Directory 256A
D Files 256A Dim(n)
**Free
DCL-DS UPLOADINFO QUALIFIED;
NUMFILES ZONED(3:0);
DIRECTORY CHAR(256);
FILES CHAR(256) DIM(n);
END-DS UPLOADINFO;
The name of the data structure in the application must match exactly to the field bound to this property. The "Files" subfield must be dimensioned "n" times, which should be the same value used to calculate the response field length and the same value used for the "number of files" property.
The "NumFiles" subfield will contain the number of files uploaded in the current transaction. This value can be between 0 and "n". The "Directory" subfield will contain the name of the IFS directory where the files were uploaded. The "Files" array subfield will contain the names of all files uploaded, in order of their selection in the file upload widget.
An example of using the file upload response can be found in the example program in library PUISAMPLES. The display file is member UPLD001D in file QDDSSRC. The RPG code is member UPLD001R in file QRPGLESRC.
Using Upload Response with Profound.js
The upload response data structure can be used in a Profound.js module similarly to how its used in RPG.Â
The data structure should be defined in the program as follows:Â
pjs.define("upload_info", { type: "data structure", qualified: true, elements: {
"num_files": { type: "zoned", length: 3, decimals: 0 },
"directory": { type: "char", length: 256 },
"files": { type: "char", length: 256, dim: 2}
}});
An example of how to use the file upload response with Profound.js can be found in the example program in the pjssamples folder in your Profound.js installation directory: /profoundjs/modules/pjssamples/. The example program is named upload.js and uses the upload.json display file.Â