4.1.3. filemanager

A filemanager field is a replacement for the regular file field. Instead of opening a file browser letting users upload a file from their own computer, the filemanager field will open the TinyMCE FileManager in standalone mode, allowing the user to either pick a file from the already uploaded files, or upload a new file and pick that one.

Implementation is as trivial as any other type:

<field id="file" type="filemanager" multiLingual="0">
  <title lang="en">File</title>
  <title lang="da">Fil</title>
</field>

When retrieving a field of this type via an M2_Content::get() call you get back an array that looks pretty much like the ones you get for file or image types - it has the following keys:

There are a couple of things to bear in mind when you choose the filemanager type over the regular file type - the pros and cons are listed here:

Table 33. Pros and cons of the filemanager field type

ProsCons
  • You get a sleek interface for uploading files with progress bar and everything (requires flash, or the file manager will revert to regular http upload.)

  • You can upload files of "unlimited" size (the limit is configurable per site and the default is 200MB.)

  • You can reuse files already uploaded via the file manager, eliminating duplicates in the system.

  • You can't apply any rules in the XML, like mime type filtering.

  • You can't apply scaling to images that are uploaded via the file manager - everything will be used "as-is".

  • Files can't be kept safe in the database - they will always be available directly on the filesystem, regardless of password protection etc.


Note

Remember that you can not access these files with filesystem functions, as they are really proxied from the administrative pages, just like any other binary file in Moski2.net.