You can use a DSP tag library form element to enable users to upload files. The form defines the input as type file and makes sure that there is a place to put the file. Here is an example of a file upload form element:

<dsp:form enctype="multipart/form-data" action="a_page.jsp" method="post">
   Pick a file to upload:
   <dsp:input type="file" bean="/FileUploadComponent.uploadProperty" value=""/>
   <dsp:input type="submit" value="Upload now"/>
</dsp:form>

This form must exist in a JavaServer Page. The enctype multipart/form-data and the method post are required for file upload. For the purposes of the upload itself, the value of the action attribute is not important.

The crucial attribute, the bean= attribute, is in the file input tag. This attribute links to a Nucleus component written by you and containing as a property a member of type atg.servlet.UploadedFile. Here, that component is /FileUploadComponent, and its property is named uploadProperty. The file upload component’s property must have the usual getX and setX methods required of a JavaBean.

 
loading table of contents...