ファイルマネージャアプリケーションを作成しました ファイルをダウンロードしようとすると問題が発生します uploadsディレクトリにあるファイルと私のPHPのtempディレクトリから移動したフォルダのアクセス許可を継承していけないので、私はPHPのエラーログで、このエラーを得たreadfile():ストリームを開くことに失敗しました:Windowsサーバーで許可が拒否されました。IIS 8
PHP Warning: readfile(files/xxx.zip): failed to open stream: Permission denied in ...
私はIISの内側に移動して、[セキュリティ]タブに移動して、それが
<?php
set_time_limit(0);
ini_set('memory_limit', '2147483648');
$file = "files/".htmlspecialchars($_GET["file"]);
$quoted = sprintf('"%s"',addcslashes(basename($file),'"\\"'));
$size = filesize($file);
if (file_exists($file)) {
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Type: force-download");
header("Content-Disposition: attachment; filename=".$quoted);
header("Content-Transfer-Encoding: binary");
header('Connection: Keep-Alive');
header("Content-Length: ".$size);
ob_clean();
flush();
readfile($file);
} else {
header("Location: fileNotFound.php?file=$file");
}
を働く継承権限を適用
許可を確認してください –
[ストリームを開くことに失敗しました:許可が拒否されました]エラー - Laravel](https://stackoverflow.com/q/23540083/6521116) –
許可をそのディレクトリに変更しましたか? –