私の電子ブックリーダー(Sony PRS-T1)の内蔵ブラウザーは非常に愚かで、ダウンロードする代わりに.epubファイルをテキストファイルとして開くため、この.htaccessファイルでの.epubファイルをダウンロードするには、ブラウザを強制しようとした:ヘッダーadd Content-Disposition "attachment"が内部サーバーエラーを引き起こします
<FilesMatch "\.(?i:epub)$">
ForceType application/octet-stream
Header add Content-Disposition "attachment"
</FilesMatch>
はしかし、これは内部サーバーエラーが発生:私はHeader add Content-Disposition "attachment"
を除外すると、エラーが
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
ありませんが - ただし、ブラウザはファイルをダウンロードしませんでした:(
何か間違っていますか?内部サーバーエラーはどこから発生しますか?
[EDIT 2013年4月11日]
私はいくつかの情報を追加することを思い出し、このスレッドは、「人気の質問バッジ」を獲得しました。
私は最終的に以下のPHPの機能とソニーのPRS-T1ブラウザ上でダウンロードを強制するために管理
function startDownload($path, $mimeType) {
if(!file_exists($path)) {
// File doesn't exist, output error
exit('file not found');
} else {
$size = filesize($path);
$file = basename($path);
// Set headers
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=\"$file\"");
header("Content-Type: $mimeType");
header("Content-Transfer-Encoding: binary");
header("Content-Length: $size");
// Read the file from disk
readfile($path);
}
exit();
}
・ホープ1日誰かを助けること。
あなたのログは言う解決
問題...? –
申し訳ありませんが、私のサーバーではありません - おそらく私はログを要求することはできますが、実際にはわかりません。 – speendo
[Content-Dispositionヘッダーを特定のディレクトリのファイルにのみ添付ファイルに設定する]の可能な複製?](http://stackoverflow.com/questions/3977159/set-content-disposition-header-to-attachment-only-on- files-in-a-certain-director) –