observe_filestore_request/2

Perform a direct, synchronous filestore upload, download or deletion.

Type: first.

Unlike #filestore{action=upload}, this request performs network I/O and does not use the managed upload queue. Avoid sending it while holding database locks. Return ok or {error, Reason}; undefined means no observer handled the request.

#filestore_request{} properties (defined in zotonic_file.hrl):

  • action: upload, download, or delete.
  • remote: backend-relative path, resolved through #filestore_credentials_lookup{}.
  • local: local source for upload or destination for download; unused for deletion.
  • mime: optional upload MIME type, guessed from the local file when omitted.
  • handler_pid: reserved field; the standard handler ignores it and returns the result synchronously. It does not send a completion message to this PID.

The standard handler rejects uploads and deletions in read-only mode. Direct requests do not establish managed media references or apply managed GC retention. See module#mod_filestore for backend configuration.

Edit on GitHub

Observed by

Modules

mod_filestore

Store uploaded media and generated previews on S3-compatible storage, FTP/FTPS, or WebDAV. Zotonic keeps a database registry of remote files and serves them…