Attachments

StatusNet 0.8 and later support uploading files as attachments to notices.

Under the hood
Attachment processing currently can happen in two code paths:
 * web UI, through NewnoticeAction
 * mail channel, through MailerDaemon

Per-user quotas are enforced at upload time, via checks in File::isRespectsQuota.


 * file_quota (max size per file) default 5,000,000 bytes
 * user_quota (lifetime max per user) default 50,000,000 bytes
 * This sounds a little harsh... how could a user expand their quota over time? --brion 17:24, 11 October 2009 (UTC)
 * monthly_quota (monthly max per user) default 15,000,000 bytes

Uploaded files have their content-types checked via the PEAR::Mime_Type module (which uses the file command as its backing -- configurable via $config['attachments']['file'] to change from default /usr/bin/file). Only files matching whitelisted MIME types are allowed through.

Types allowed by default:
 * image/png
 * image/jpeg
 * image/gif
 * image/svg+xml
 * audio/mpeg
 * audio/x-speex
 * application/ogg
 * application/pdf
 * application/vnd.oasis.opendocument.text
 * application/vnd.oasis.opendocument.text-template
 * application/vnd.oasis.opendocument.graphics
 * application/vnd.oasis.opendocument.graphics-template
 * application/vnd.oasis.opendocument.presentation
 * application/vnd.oasis.opendocument.presentation-template
 * application/vnd.oasis.opendocument.spreadsheet
 * application/vnd.oasis.opendocument.spreadsheet-template
 * application/vnd.oasis.opendocument.chart
 * application/vnd.oasis.opendocument.chart-template
 * application/vnd.oasis.opendocument.image
 * application/vnd.oasis.opendocument.image-template
 * application/vnd.oasis.opendocument.formula
 * application/vnd.oasis.opendocument.formula-template
 * application/vnd.oasis.opendocument.text-master
 * application/vnd.oasis.opendocument.text-web
 * application/x-zip
 * application/zip
 * text/plain
 * video/mpeg
 * video/mp4
 * video/quicktime
 * video/mpeg

Client problems
Attachments don't get properly added to the notice text if you have disabled automatic URL shortening in your account preferences.

Buggage with Internet Explorer has been reported.


 * http://status.net/trac/ticket/1826 (possibly fixed?)
 * http://status.net/trac/ticket/1831 - Attachment not cleared from form after sending a notice in IE 8

Server problems
Common problems with uploading:
 * Make sure the  subdirectory is writable by the user the web server runs as (the installer should check for this)
 * Check php.ini for PHP configuration settings...
 * (should be 'On')
 * (system default temp dir or one that exists and is writable to web server)
 * (default 2M)
 * (default 8M)
 * (default unlimited)
 * probably needs to be off

Known bugs...
 * http://status.net/trac/ticket/1787 - Attach File Fails (missing /usr/bin/file)
 * http://status.net/trac/ticket/1739 - Not uploading attachments
 * http://identi.ca/conversation/17247553#notice-17254885 - Someone should mention somewhere that 'other media types' need to be enabled before uploading anything (apologies for the bad formatting, I'm new here).

Feature reqs

 * http://status.net/trac/ticket/1765 - Attachment preview for oEmbed-enabled URIs
 * http://status.net/trac/ticket/62 - License per attachment
 * http://status.net/trac/ticket/1918 - HTML 5 drag-and-drop upload support