It's better when it's simple

User Tools

Site Tools


Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community

Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy



handles status codes when downloading a media resource
process 300-304 with redirect, send 200 OK and output a status message for >=203

This event can be used to process the status codes for a media resource request in lib/exe/fetch.php. It can be used to redirect users to an error page for media resources not being found or to accept arbitrary resource requests and send convenient files back. This is processed before the MEDIA_SENDFILE and offers a BEFORE and an AFTER processing 1).

Passed Data

  • $data['media'] – The id for the called file
  • $data['file'] – The filename of the file about to be delivered, can be modified by your plugin
  • $data['mime'] – The Mime-Type of the file, can be modified by your plugin
  • $data['download'] – Whether the file is to be downloaded or displayed inline
  • $data['cache'] – The wanted cache behavior (-1 = cache forever, 0 = never cache, >0 cache time in seconds), can be modified by your plugin
  • $data['ext'] – Extension of the file
  • $data['width'] – Images only: the wanted width as specified in the request
  • $data['height'] – Images only: the wanted height as specified in the request
  • $data['status'] – The current status code of the request
  • $data['statusmessage'] – The status message corresponding to the status above

See also

AFTER is only fired for a HTTP status lower than 204
devel/event/fetch_media_status.txt · Last modified: 2018-12-08 15:18 by torpedo