A file
field is for uploading any binary data to a
type.
If you are uploading images you should use the image type instead.
Two things set the file field aside from other fields:
You can use the special mimetypes rule on it:
<field id="file" type="file" multiLingual="0"> <title lang="en">File</title> <title lang="da">Fil</title> <mimetype> <valid>application/pdf</valid> </mimetypes> </field>
See the documentation for mimetypes for further details.
There is an optional visibility
attribute that
let's you decide how to treat the binary itself:
public
:
The binary will be stored in the database but also cached on
the file system, meaning that it can be accessed directly via
a URL.
secure
:
The binary is only stored in the database and will never be
cached on the file system. To relay the file to your visitors
you should use M2_Content::streamBinary().
So, to secure your files from the public, you could do this:
<field id="file" type="file" multiLingual="0" visibility="secure"> <title lang="en">File</title> <title lang="da">Fil</title> </field>