Sunday, 1 February 2015

APEX 5 supporting file enhancements

Existing behaviour

In APEX 4.2, files can be uploading through shared components, and can either be associated with an application or workspace, and can be stored in either:

  1. Cascading Style Sheets
  2. Images
  3. Static Files

These files can generally be found in the view: APEX_WORKSPACE_FILES

Files are then referenced throughout the application by: #APP_IMAGES#<file_name> or #WORKSPACE_IMAGES#<file_name>

Files can also be included in application exports, by creating an installation script for these files (to ensure they are available when deployed):

Select Create Scripts to Install Files under tasks when creating a new installation script:

Then it's just a matter of selecting which files to include in the installation script

New behaviour

In the current form, this has changed to divide files up into application files and workspace files:

This file uploader is not a multi-file uploader control, but it now has support for uploading a zip, which can be extracted after upload - a nice way to upload multiple files in one hit. A word of warning, if you attempt to upload a file in the same path that already exists, it will simply be replaced, without warning.

These files would be referenced in two new views: APEX_APPLICATION_STATIC_FILES AND APEX_WORKSPACE_STATIC_FILES

This substitution string remains the same: #APP_IMAGES# and #WORKSPACE_IMAGES# accordingly.

Another new feature, is that relative paths are supported. So e.g you could have a zip with images, css directories, after you upload the zip, you can refer to files like so: #APP_IMAGES#css/<css file_name>

The docs say it not necessary to create that supporting object script any more for static files and indeed that seems to be the case - they are automatically included in application exports - with no apparent ability to disable this.

disclaimer: This is based on the current early adopter (3) instance of apex