https://stackoverflow.com/a/10743881/1303216
I'm currently working off of this. I copy and pasted the code and have been tinkering to get it to work. On the webroot of my server there is a folder called secretfolder. In public_html there is a PHP file with the script to fetch my hidden PDF (copied code). The problem is, the files keep coming out corrupt and when I look at them in Notepad, I get
failed to open stream: No such file or directory in <b>/home/user/public_html/herp.php
How do I get it to point outside of public_html. I don't entirely understand relative file paths so some help would be great.
I'm on a standard LAMP
Short Question
What would the relative file path be from a PHP file in Public_html that needs to point to /secretfolder that is directly on the webroot?
Side note, I didn't just try $file = '/path/to/file/outside/www/secret.pdf'; but I need to know what that is supposed to be in actual use.
Update
The file path I was using was /secretfolder/Pay%20Stub%20View.pdf
%20 (Spaces) for some reason was breaking it. It works fine now. I feel kind of dumb. Can anyone explain why this happens? All I know is that it does.