Configuring Filetypes in vBulletin

From EIRMA Wiki

Jump to: navigation, search
Quick Links

Overview and Tutorial


Pre-Installation

Installation

Post-Installation


Administration


Moderation


Design


Advanced


Other

Contents


Introduction

LDM uses the vBulletin Attachments table (VB->Admincp->Attachments->Attachment Manager) to control how it handles files. A file is only recognised as:

  • downloadable or
  • uploadable or
  • media playable in the Jukebox

if an entry for its filetype is found in the main vBulletin attachments table, together with valid mimetype information. Otherwise, the filetype is considered to be a link.

vBulletin comes pre-configured with information on some standard filetypes. Check the Attachments table and set up entries for all required filetypes. This can be done:

  • Manually: Use the sequence VB->Admincp->Attachments->Attachment Manager->Add New Extension, fill in the filetype field and provide appropriate mimetype data (see below). Mimetype information for common filetypes is summarised below. Use the format Content-type: string1/string2. Leaving out "Content-type" leads to obscure browser errors.
  • Automatically: The LDM extra add-mimetypes-plugin (see the /release/extras directory in the installation) installs many common media file extensions into vBulletin.

Other LDM settings further restrict which filetypes are accepted as uploads, images and media types. LDM->Admin->Filetypes summarises any conflicts between LDM and vBulletin settings.

LDM will recognise and process all filetypes defined in the vBulletin attachments table, regardless of whether they are marked as enabled. This means that you can use a filetype within LDM, but disallow uploads as forum attachments in vBulletin, by marking the filetype as disabled for that purpose in the attachments table. (For uploads, LDM does apply Attachment Permissions restrictions, as described below.)

Uploads

LDM provides further controls on file uploads by user, usergroup and filetype:

  • The filetype usergroup permissions, defined in the vBulletin admin/attachment permissions, trump everything. If a user does not have this permission for a given filetype, he can’t upload it, full stop.
  • If the LDM setting upload_filetypes has a non-empty value for the current category (i.e. is defined in the category or inherited from a parent category or the global setting), this defines the full list of filetypes that can be uploaded, provided they also appear in the admin/attachment management page
  • If upload_filetypes is empty for the current category, then all filetypes in the vb admin/attachment management page can be uploaded.
  • Administrators can always upload files up to the limits set in your web server's php.ini file, parameters post_maxsize and upload_max_filesize, see Site Configuration).
  • For all other users, the maximum filesize that can be uploaded is defined by the corresponding maximum filesize given in the vBulletin Attachments table, or (if smaller) by the limits imposed in your web server (php.ini file.

Mimetypes

When a file is transferred over the internet, the transfer includes a number of directives (called headers) that help the receiving computer determine how to handle the transfer. The headers include what is called mimetype information, which indicate the type of data, e.g. video, audio, text. Mimetype information is set up in the vBulletin attachments table and (see below) in the web server configuration.

The following table lists some useful mimetype entries. See also (e.g.) the Webmaster Toolkit.

Mimetypes
avi Content-type: video/avi
bmp Content-type: image/bmp
divx Content-type: video/divx
doc Content-type: application/msword
flv Content-type: application/x-shockwave-flash
gif Content-type: image/gif
jpe, jpeg, jpg Content-type: image/jpeg
m3u Content-type: application/m3u
mov Content-type: video/quicktime
mpg, mpeg Content-type: video/mpeg
mp3 Content-type: audio/mpeg
pdf Content-type: application/pdf
png Content-type: image/png
ram Content-type: audio/x-pn-realaudio
rar Content-type: application/x-rar
rm Content-type: audio/x-realaudio
rmvb Content-type: video/x-realaudio
rpm Content-type: audio/x-pn-realaudio-plugin
swf Content-type: application/x-shockwave-flash
txt Content-type: plain/text
wma Content-type: video/x-ms-wma
wmv Content-type: video/x-ms-wmv
zip Content-type: application/zip

Server and Browser Configuration

Sometimes, you may need to take more aggressive measures to ensure that your users receive files as you and they intend. For example, utilities such as Adobe Acrobat and Windows Media Player integrate themselves with the user's browser, so that they will launch automatically when the browser receives a datastream with the appropriate mimetype header. This can make it difficult or impossible for the user to save the file.

For LDM entries that are handled as downloads (i.e. filetypes present in the vBulletin attachments table), you can overcome this problem by setting the LDM->Admin->Setting force_saveas to 1. This will send the correct headers to instruct the browser to offer a "save as" dialogue. Another approach is to specify the mimetype as Content-type: application/force-download in the vBulletin attachments table.

These solutions will not work for entries that are handled as links, because LDM does not handle the transfer and so cannot control the headers that accompany the file transfer. In this situation, the web server normally determines which mimetype information to send by referring to its own filetype table. It is possible to reconfigure the web server to send different headers for certain filetypes. For example, if you are using an Apache server and want to ensure that links with .wmv file extensions will be saved rather than played automatically, enable the mod_headers module and add the following commands to the main configuration or virtual hosts file or to an .htaccess file:

<FilesMatch "\.(wmv|WMV)$">
ForceType application/octet-stream
Header set Content-Disposition attachment
</FilesMatch>
Personal tools