php - How to prevent file location from showing? -


i allowing users upload documents server. however, don't want them see files being stored. can allow them still file without seeing file location.

you can use php query accomplish this, lets use following url:

http://mysite.com/files.php?file=xyz.pdf 

in files.php can check variable file , have hard coded function retrieves file. can many ways 1 using headers force download or read file var , print it's contents page. pdf reading file , printing page same linking file.

warning though: using headers not print page except file. recommend declairing headers still if read file , print end user not gobbly goop source of file i.e. jpg or pdf.

oh no, forgot header warning, have been running header problem ever since adobe made iso pdf's open source, depending on application produced pdf , browser user uploading pdf from, header from:

'application/pdf', 'application/x-download','application/octet-stream','application/octet','binary/octet-stream' 

so careful hard coding upload section header type, know question downloads thought throw in there. using headers downloads doesn't matter use standard application/pdf there.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -