Skip to end of metadata
Go to start of metadata

In this section, you will learn how to configure the Upload service that is defined by the org.exoplatform.upload.UploadService class.

This can be configured with the following XML code:

This code allows uploading files with the default size limit (10MB). The default value unit is in Megabytes.

This limitation will be used by default by all applications if no application-specific limit is set. Setting a different limit for applications is discussed in a later section.

If the value is set to 0, the upload size is unlimited.

By default, GateIn allows everyone to upload resources to server through the Upload component on UI or by accessing directly the "/upload" handler. Therefore, we may cause some problems about the server disk space. If you do not want everyone who was not logged be able upload to your server, you should configure UploadHandler as follows:

Use the upload component
  1. Create an org.exoplatform.webui.form.input.UIUploadInput object type by using one of three following constructors:
    • The default constructor that allows uploading the file with the size of 10 MB.
    • This constructor allows you to customize the size limit of uploaded files by using the limitSize parameter. The default value unit is in Megabytes.
    • This constructor allows you to customize the size limit and the value unit by using the limitSize and unit parameters respectively.
      In GateIn, you can set the value unit to Megabytes (MB), Kilobytes (KB) or Gigabytes (GB).

      The following is an example using the third form:

  2. Obtain the limit from the XML configuration by adding the following code to either portlet.xml or portlet-preferences.xml:
    The 0 value means the upload size is unlimited, and the value unit is set to MegaBytes.
  3. Use the getUploadDataAsStream() method to get the uploaded data:

    The upload service stores a temporary file on the file system during the upload process. When the upload is finished, the service must be cleaned to:

    • Delete the temporary file.
    • Delete the classes used for the upload.
  4. Use the removeUploadResource(String uploadId) method defined in the upload service to purge the file:
    Saving the uploaded file
    Ensure the file is saved before the service is cleaned.
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 04, 2013

    Content incorporated into Enterprise docs up to version 3.