This control to selects a file for upload. The control generates a input field and a "Browse" button. The "Browse" button activates the file browser and allows selecting the file interactively. To use the selected file in the fileUpload control you need another control, for example, a button named "Start upload", to finally start the upload.
If you use a fileUpload control in the JSP you must set the encondingType attribute of the form control to "multipart/form-data".
Example: <hbj:form encodingType="multipart/form-data" >
· id
Identification name of the fileUpload.
· accept
Defines the accepted MIME type.
· maxLength
Defines the maximum file size in byte allowed for the upload. By default there is no limit.
· size
Defines the width of the fileUpload inputField in characters. The frame of the inputField is adjusted accordingly considering the actual text font and the design attribute.
Attributes |
M |
Values |
Usage |
id |
* |
String (cs) |
Taglib Classlib |
accept |
|
String |
Taglib Classlib |
maxLength |
|
Numeric (-1) |
Taglib Classlib |
size |
|
Numeric (20) |
Taglib Classlib |
using the taglib
<hbj:form |
In an application you usually have an additional control, usually a button, to start
the upload once the file has been selected with the "Browse..." button.
Here we show what the server program has to do when the user starts the upload.
In our example we define a button with an "onClick" event and specified as "onClick"
event handling method "onLoadFile". The "onLoadFile" method does the upload handling.
public void onLoadFile(Event event) { |