Skip to content
Advertisement

How to return a file in PHP

I have a file

JavaScript

A user comes to

JavaScript

I want the user’s browser to start downloading the file. How do i do that? Does readfile open the file on server, which seems like an unnecessary thing to do. Is there a way to return the file without opening it on the server?

Advertisement

Answer

I think you want this:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement