Search the Community
Showing results for tags 'webroot'.
Found 1 result
I have some files saved outside the webroot and need to allow posts in WordPress to be able to access the files. Following is the location of one of the files: /home1/Mathone/TESTS/Test1/index1.html I created a Download.php file with the following code and saved it to public_html of my site: <?php $path = '/home1/Mathone/TESTS/'. $_GET['filename']; $mm_type="application/octet-stream"; 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: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); // outputs the content of the file exit(); ?> Next, I created a post in wordpress with the following link: <a href="www.mysite.com/download.php?filename=Test1/index1.html">download</a> I am getting an error This is somewhat embarrassing, isn’t it? It seems we can’t find what you’re looking for. Perhaps searching can help. Can anyone tell me what I am doing wrong? Thank you