Re: implementing downloads with php?
| From: | Sean Greenslade | Date: | Thu, 02 Apr 2015 23:08:36 +0000 |
| Subject: | Re: implementing downloads with php? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324752@lists.php.net to get a copy of this message | ||
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
> JK
Can 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?
--Sean