
08-30-2002, 07:07 AM
|
|
Newbie
|
|
Join Date: Aug 2002
Location: Originally from Bolton, England. I have been working in Brussels, Belgium for the last 2.5 years.
Posts: 29
|
|
Automatically start download dialogue
Hi
I have seen a few sites which send me an email containing a web page link to receive a free download of an ebook, for example.
I then click on the web page in the email and the ftp dialogue automatically starts and all I have to do is select the location on my PC where I want to save the file.
Does anyone know how this is done?
Cheers
Andy
|

08-30-2002, 07:11 AM
|
|
Junior Guru Wannabe
|
|
Join Date: Jul 2002
Location: UK
Posts: 79
|
|
Certain mime types will do that automaticly
like
.gz
.zip
.exe
ETC.
__________________
Proxima Web-Hosting
|

08-30-2002, 07:11 AM
|
|
Newbie
|
|
Join Date: Aug 2002
Location: New Zealand
Posts: 8
|
|
its done through your operating system its just a default setting nothing to do with PHP
|

08-30-2002, 08:08 AM
|
|
Web Hosting Master
|
|
Join Date: May 2002
Location: UK
Posts: 2,994
|
|
You do this using content-disposition in the header.
e.g. (note this example is for inline download... i.e. the current PHP script echos the file content). You can do a similar thing for a remote file as well
PHP Code:
header("Content-Type: application/pdf");
header("Content-Length: " . $length);
header("Content-Disposition: inline; filename=" . $filename);
echo $document;
|

08-30-2002, 11:52 AM
|
|
Web Hosting Master
|
|
Join Date: Jan 2002
Location: Kuwait
Posts: 679
|
|
FTP doesn't have content disposition 
|

09-01-2002, 04:40 AM
|
|
Newbie
|
|
Join Date: Aug 2002
Location: Originally from Bolton, England. I have been working in Brussels, Belgium for the last 2.5 years.
Posts: 29
|
|
Hi
Does anyone know where I can find an example of how this is done?
Cheers
Andy
|

09-01-2002, 05:26 AM
|
|
Web Hosting Guru
|
|
Join Date: Jul 2002
Location: Australia
Posts: 324
|
|
Quote:
Originally posted by AC1
Hi
Does anyone know where I can find an example of how this is done?
Cheers
Andy
|
try... http://www.hotscripts.com
|

09-01-2002, 06:27 AM
|
|
Web Hosting Master
|
|
Join Date: May 2002
Location: UK
Posts: 2,994
|
|
You initiate the download to an FTP source from an http connection. That's how all these downloads sites do it.
The example I gave is for an inline download. What you need is to use content-disposition for a remote file
|

09-01-2002, 11:41 AM
|
|
Web Hosting Guru
|
|
Join Date: Jun 2001
Location: San Diego, CA
Posts: 283
|
|
Quote:
Originally posted by Rich2k
You initiate the download to an FTP source from an http connection. That's how all these downloads sites do it.
The example I gave is for an inline download. What you need is to use content-disposition for a remote file
|
Rich,
How to do force an FTP transport when you've already initiated an HTTP connection?
header() won't work.
-davidu
__________________
EveryDNS.NET :: FreeDNS and more.
|

09-02-2002, 08:35 AM
|
|
Web Hosting Master
|
|
Join Date: Aug 2002
Location: Baltimore, Maryland
Posts: 580
|
|
i would suggest using Rich2k's code spinnet or just being lazy and doing this: header("Location: filepath_here");
|

09-02-2002, 11:32 AM
|
|
Web Hosting Guru
|
|
Join Date: Jun 2001
Location: San Diego, CA
Posts: 283
|
|
Quote:
Originally posted by dreamrae.com
i would suggest using Rich2k's code spinnet or just being lazy and doing this: header("Location: filepath_here");
|
I want to know how to initiate an FTP connection with PHP from an established HTTP connection.
Rich2k can do it, I just want to know how.
-davidu
__________________
EveryDNS.NET :: FreeDNS and more.
|

09-02-2002, 12:47 PM
|
|
Web Hosting Master
|
|
Join Date: Dec 2000
Location: San Diego, CA
Posts: 1,571
|
|
Couldn't you force the content type to be "application/octlet-stream"? Every browser I've seen will show the download dialog when that is received.
|

09-02-2002, 01:05 PM
|
|
Web Hosting Guru
|
|
Join Date: Jun 2001
Location: San Diego, CA
Posts: 283
|
|
Quote:
Originally posted by mind21_98
Couldn't you force the content type to be "application/octlet-stream"? Every browser I've seen will show the download dialog when that is received.
|
Yep. That's a great technique. In fact, the PDF example rick2k gave would most likely result in Acrobat being loaded into the window of the browser depending on the browser settings and if acrobat is installed.
Code:
application/octet-stream
is one of the few ways I know to force a file:  ave dialog.
-davidu
__________________
EveryDNS.NET :: FreeDNS and more.
|

09-02-2002, 04:56 PM
|
|
Web Hosting Master
|
|
Join Date: Jan 2002
Location: Kuwait
Posts: 679
|
|
As far as I know, there are no MIME types in the FTP specifications. It totally depends on how your operating system is set up. Using HTTP, though, to point to an FTP file and define its MIME types is something new to me.
|

09-02-2002, 05:11 PM
|
|
iNET Interactive
|
|
Join Date: May 2001
Location: Dayton, Ohio
Posts: 4,869
|
|
For downloading a file off of an FTP:
http://www.php.net/manual/en/function.ftp-get.php
You'll need PHP compiled with ftp support....
__________________
-Mat
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|