PHP in a html page?

Reply

Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: PHP in a html page?

 
0
  #21
Mar 13th, 2006
Try the following:

[PHP]<?php

$file = 'http://www.martinkorner.host.sk/Swim.exe'; //Windows
$file = '/mnt/storage/users/m/a/r/martinkorner/Swim.exe'; //or Linux
$new_filename = '"Swim To The Sea.exe"';

{
header("HTTP/1.1 200 OK");
header("Status: 200 OK");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache");

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".$new_filename);
readfile($file);
exit();
}
?> [/PHP]

$file = 'http://www.martinkorner.host.sk/Swim.exe'; //Windows
You understand that the line below completely overwrites the line above right?
$file = '/mnt/storage/users/m/a/r/martinkorner/Swim.exe'; //or Linux
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: PHP in a html page?

 
0
  #22
Mar 14th, 2006
So If I use the windows one, will linux users still be able to access the download?

Martin
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 355
Reputation: DanceInstructor is an unknown quantity at this point 
Solved Threads: 14
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: PHP in a html page?

 
0
  #23
Mar 14th, 2006
The reference was to the operating system on the server, not the client-side operating system. Use the linux one. It is the one that has been being used anyway.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 348
Reputation: paradox814 is an unknown quantity at this point 
Solved Threads: 4
paradox814's Avatar
paradox814 paradox814 is offline Offline
Posting Whiz

Re: PHP in a html page?

 
0
  #24
Mar 14th, 2006
Originally Posted by martinkorner
So If I use the windows one, will linux users still be able to access the download?

Martin
yes they will, but realisticly speaking it will do them no good, exe files are generally compiled for windows, not linux users (unless they use wine).
You would have to take that program and recompile it for a linux users (this is way more technical, and not within the scope of this forum). But yes the linux users will be able to download it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: PHP in a html page?

 
0
  #25
Mar 14th, 2006
Oh right, thanks

Martin
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: PHP in a html page?

 
0
  #26
Mar 14th, 2006
Originally Posted by paradox814
yes they will, but realisticly speaking it will do them no good, exe files are generally compiled for windows, not linux users (unless they use wine).
You would have to take that program and recompile it for a linux users (this is way more technical, and not within the scope of this forum). But yes the linux users will be able to download it.
Right.. thanks

Martin
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: PHP in a html page?

 
0
  #27
Mar 17th, 2006
I removed the space before the "<?php" tag and now it works properly in both browsers! (Thanks DanceInstructor for the pm).

At the moment that just downloads over the previous page, how would I get it to link to a html page, so for example, the user clicks a link which takes them to a page saying: "You're download should have started, if not please click here." and the download dialogue box appears.

Thanks
Martin
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 73
Reputation: UberAAZ is an unknown quantity at this point 
Solved Threads: 1
UberAAZ's Avatar
UberAAZ UberAAZ is offline Offline
Junior Poster in Training

Re: PHP in a html page?

 
0
  #28
Apr 3rd, 2006
You don't link to a page, you just make your existing download page say that.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC