!--a11y-->
Web
Dynpro FileUpload API – IWDFileUpload 
You can use the FileUpload UI element to upload files from the client to the server. The UI element appears with an input field, in which the directory path and the file name appear, and a button for searching for the file. See the following graphic:

The data property determines the data drain in the context. The fileName property contains the file name of the file to be uploaded.
·
data
Determines the data drain,
that is, the location of the data, of the file to be uploaded in the context.
The system can only read this data value.
·
fileName
Determines the name of the file to be uploaded. The system can only read the
value of this property.
·
width
Determines the width of the FileUpload UI element that you can specify in CSS
sizes, such as em, ex, pixels or percentage values.
Name |
Interface |
Type |
Initial Value |
Bindable |
Value Required |
data |
IWDFileUpload |
Object |
|
bindable_mandatory |
Yes |
IWDUIElement |
boolean |
true |
bindable |
No |
|
fileName |
IWDFileUpload |
String |
|
bindable |
No |
IWDUIElement |
String (TranslatableText) |
|
bindable |
No |
|
IWDUIElement |
WDVisibility |
visible |
bindable |
No |
|
width |
IWDFileUpload |
String |
|
bindable |
No |
At design time, you add the FileUpload UI element to an appropriate view. You then define a value attribute of type binary in the context of this view, also at design time; for the source text below the value attribute is called FileUpload.
The data property must be bound to this value attribute of data type binary, so that the file can be uploaded as a byte array. At runtime, the binary data type can be enriched with data to allow the passing of related information when uploading a file. To do this, you must implement the following source text in the wdDoInit method of the controller implementation, with which the binary data type is enhanced with additional information at runtime:
public void wdDoInit() { //@@begin wdDoInit() // The FileUpload UI element requires: IWDAttributeInfo attInfo = wdContext.nodeRoot().getNodeInfo().getAttribute("FileUpload"); binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
//@@end } |
In addition, you can use the IWDModifiableBinaryType data type, which represents an extension of the binary data type, to access the MIME type of the file, that is, either read or set the MIME type or read or set the file name of the Web resource.
Method Name |
Parameter |
Return Value |
Short Description |
bindData |
(String path) |
|
Binds the value of the data property to the content element specified by the path. |
bindFileName |
(String path) |
|
Binds the value of the fileName property to the content element specified by the path. |
bindingOfData |
|
String |
Returns the path of the content element to which the data property is bound. Returns NULL if no binding exists. |
bindingOfFileName |
|
String |
Returns the path of the content element to which the fileName property is bound. Returns NULL if no binding exists. |
bindingOfWidth |
|
String |
Returns the path of the context element to which the width property is bound. Returns NULL if no binding exists. |
bindWidth |
(String path) |
|
Binds the value of the width property to the context element specified by the path. |
getData |
|
Object |
Returns the value of the data property. |
getFileName |
|
String |
Returns the value of the fileName property. |
getWidth |
|
String |
Returns the value of the width property. |
setData |
(Object data) |
|
Sets the value of the data property. |
setFileName |
(String fileName) |
|
Sets the value of the fileName property. |
setWidth |
(String width) |
|
Sets the value of the width property. |
Additional methods described in the following APIs are available using inheritance:

For detailed documentation of all inherited methods, see the documentation for the relevant APIs.
