Can i restrict a file to direct download.suppose in my domain i am having a upload folder in which i am having a exam.pdf file then it should not be downloaded by accessing url http://www.mydomain.com/upload/exam.pdf . If it is possible then please tell me the way.
daniel36 -7 Light Poster
Recommended Answers
Jump to PostIf you are using Apache web server then use an .htaccess file, with this directive:
order allow,deny deny from all
put this inside upload directory.
Jump to Postor
@readfile("./path/to/your/file");
to output the content of these files. Take care that you might want to manipulate the headers for the correct content, name and size.
All 5 Replies
cereal 1,524 Nearly a Senior Poster Featured Poster
daniel36 -7 Light Poster
daniel36 -7 Light Poster
cereal 1,524 Nearly a Senior Poster Featured Poster
sDJh 39 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.