# packages/file-storage/www/download.vuh ad_page_contract { Virtual URL handler for file downloads @author Kevin Scaldeferri (kevin@arsdigita.com) @creation-date 18 December 2000 @cvs-id $Id: index.vuh,v 1.1 2001/04/20 20:51:10 donb Exp $ } { {version_id:integer ""} } set user_id [ad_conn user_id] regexp "[ad_conn package_url]download/(.*)" [ad_conn url] match path if [empty_string_p $version_id] { if ![db_0or1row get_file_id " select content_item.get_live_revision(content_item.get_id(:path,file_storage.get_root_folder([ad_conn package_id]))) as version_id from dual"] { ad_script_abort } } ad_require_permission $version_id "read" db_1row file_type " select mime_type from cr_revisions where revision_id = :version_id" ReturnHeaders $mime_type db_write_blob version_write "select content from cr_revisions where revision_id = $version_id"