폴더 구조
/users/websupport
/public_html
이
/users/websupport/FileToDownload.pdf
download.php 파일이
에 있습니다 : 다운로드파일에 있습니다
/public_html/download.php
하지만 Firefox는 download.php에서 파일을 찾을 수 없을 때 파일을 찾을 수 없다고 알려줍니다.
나는 파일이 ftp를 통해 존재 함을 확인했다.
웹 루트 외부에 파일을 배치하면 .htaccess 사이트에 뭔가를 추가해야합니까? 내가이 문제로 어디로 가고 있는지 확실하지 않습니다. 아래는 download.php의 코드입니다.
//check users is loged in and valid for download if not redirect them out
// YOU NEED TO ADD CODE HERE FOR THAT CHECK
// array of support file types for download script and there mimetype
$mimeTypes = array(
'doc' => 'application/msword',
'pdf' => 'application/pdf',
);
// set the file here (best of using a $_GET[])
$file = "../users/websupport/2011cv.pdf";
// gets the extension of the file to be loaded for searching array above
$ext = explode('.', $file);
$ext = end($ext);
// gets the file name to send to the browser to force download of file
$fileName = explode("/", $file);
$fileName = end($fileName);
// opens the file for reading and sends headers to browser
$fp = fopen($file,"r") ;
header("Content-Type: ".$mimeTypes[$ext]);
header('Content-Disposition: attachment; filename="'.$fileName.'"');
// reads file and send the raw code to browser
while (! feof($fp)) {
$buff = fread($fp,4096);
echo $buff;
}
// closes file after whe have finished reading it
fclose($fp);
어떻게 액세스하고 있습니까? – Blaster
나는 firefox가 download.php를 찾을 수 없다, 너는 너의 URL을 다시 쓰고 있니? – jeroen
Hi Jeroen - 아니요, URL을 다시 쓰지 않습니다. –