hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Automatically start download dialogue
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Automatically start download dialogue

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 08-30-2002, 07:07 AM
AC1 AC1 is offline
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

Reply With Quote


Sponsored Links
  #2  
Old 08-30-2002, 07:11 AM
Steve-PWH Steve-PWH is offline
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

Reply With Quote
  #3  
Old 08-30-2002, 07:11 AM
Duey Duey is offline
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

Reply With Quote
Sponsored Links
  #4  
Old 08-30-2002, 08:08 AM
Rich2k Rich2k is offline
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

Reply With Quote
  #5  
Old 08-30-2002, 11:52 AM
Ahmad Ahmad is offline
Web Hosting Master
 
Join Date: Jan 2002
Location: Kuwait
Posts: 679
FTP doesn't have content disposition

__________________
Ahmad Alhashemi
PHP, Apache, C, Python, Perl, SQL
18 related BrainBench certificates

Reply With Quote
  #6  
Old 09-01-2002, 04:40 AM
AC1 AC1 is offline
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

Reply With Quote
  #7  
Old 09-01-2002, 05:26 AM
:: paVel :: :: paVel :: is offline
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

Reply With Quote
  #8  
Old 09-01-2002, 06:27 AM
Rich2k Rich2k is offline
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

Reply With Quote
  #9  
Old 09-01-2002, 11:41 AM
DavidU DavidU is offline
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.

Reply With Quote
  #10  
Old 09-02-2002, 08:35 AM
dreamrae.com dreamrae.com is offline
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");

Reply With Quote
  #11  
Old 09-02-2002, 11:32 AM
DavidU DavidU is offline
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.

Reply With Quote
  #12  
Old 09-02-2002, 12:47 PM
mind21_98 mind21_98 is offline
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.

__________________
-Mooneer
Thoughtbug Software: Hosting shouldn't require any thought.
Legitimate host? Support the Code of Ethical Conduct

Reply With Quote
  #13  
Old 09-02-2002, 01:05 PM
DavidU DavidU is offline
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.

Reply With Quote
  #14  
Old 09-02-2002, 04:56 PM
Ahmad Ahmad is offline
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.

__________________
Ahmad Alhashemi
PHP, Apache, C, Python, Perl, SQL
18 related BrainBench certificates

Reply With Quote
  #15  
Old 09-02-2002, 05:11 PM
The Prohacker The Prohacker is offline
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

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Wireless Symposium 2013 Web Hosting Events 2012-12-05 13:41:13
Jelastic Java Cloud App Deployment Gets Easier with Eclipse Partnership Web Hosting News 2012-12-17 13:50:32
Telecommunications Firm AT&T Launches Mobile Website Builder Web Hosting News 2011-09-15 20:40:54
Open Source Developer Joomla Releases 1.7 CMS with Enhanced Security Tools Web Hosting News 2011-07-19 18:51:20
Apple Releases iCloud Storage Service Details at WWDC Web Hosting News 2011-06-06 20:29:01


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?