Home > CakePHP | Lang | PHP > CakePHPでファイルのダウンロードのやり方。

CakePHPでファイルのダウンロードのやり方。

例えば、

$output_file = sprintf(DB_NAME."_%s.db", date("Ymd-hi"));
system("/usr/bin/pg_dump -u ".DB_NAME." < ".AUTH_USER_FILE_PATH." > ".DB_EXPORT_PATH.$output_file);
$this->autoRender = false;
Configure::write('debug', 0);
header("Content-disposition: attachment; filename=".$output_file);
header("Content-type: application/octet-stream; name=".$output_file);
$result = file_get_contents(DB_EXPORT_PATH.$output_file);
print($result);
return;

みたいな。

Comments:0

add to hatena hatena.comment (1) add to del.icio.us (0) add to livedoor.clip (0) add to Yahoo!Bookmark (0) Total: 1

Comment Form
Remember personal info

Trackbacks:0

Trackback URL for this entry
http://ore.saizensen.net/archives/34/trackback
Listed below are links to weblogs that reference
CakePHPでファイルのダウンロードのやり方。 from おれ最前線ねっと

Home > CakePHP | Lang | PHP > CakePHPでファイルのダウンロードのやり方。

Search
Feeds
Meta

Return to page top