Re: implementing downloads with php?
| From: | Jeffry Killen | Date: | Fri, 03 Apr 2015 00:58:49 +0000 |
| Subject: | Re: implementing downloads with php? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324753@lists.php.net to get a copy of this message | ||
On Apr 2, 2015, at 4:08 PM, Sean Greenslade wrote:
On Thu, Apr 02, 2015 at 02:51:32PM -0700, Jeffry Killen wrote:Hi; This is new territory for me a maybe a bit off topic but I am interested in finding out how to implement a downloading mechanism with php and without using ftp (if possible). I am understanding that http has a 'put' command. Is this the clue? When a file is downloaded from a site, like, for instance, a source code file from a directory. If the user does not have an ftp client, does the browser negotiate an ftp connection? As an application this could be used for file transfer via a web site. Thanks for time and attention JKCan you describe what you want in terms of the user's experience? What kind of files? Why can't you just use normal files in an http directory?
When you load a webpage, you are downloading a file via http. PHP just gives you the ability to dynamically generate / alter that file before it gets sent (downloaded). By setting the headers appropriately, the page can tell the browser to interpret the file as something other than a regular webpage (e.g. an image). There are also headers that tell the browser to prompt the user to save the page, rather than trying to display it. Is that what you were getting at? --SeanWhen a web page or a resource like an image or javascript file, or css file "downloads" it is rendered in the browser. It does not appear as a separate file written to the users system. What I am looking for is what might be described as the opposite of uploading a file. Thanks for responses JK