I have a pdf file on disk that i need to send to a user when they make a request to a php script, what is the best way of doing this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Assuming that it’s on the server:
NOTE: Just writing
won’t work. This will make the client wait for a response forever. You need to define headers so that it works the intended way. See this example from the official PHP manual: