943,520 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 7354
  • PHP RSS
You are currently viewing page 3 of this multi-page discussion thread; Jump to the first page
Mar 13th, 2006
0

Re: PHP in a html page?

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
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 14th, 2006
0

Re: PHP in a html page?

So If I use the windows one, will linux users still be able to access the download?

Martin
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Mar 14th, 2006
0

Re: PHP in a html page?

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.
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
Mar 14th, 2006
0

Re: PHP in a html page?

Quote 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.
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
Mar 14th, 2006
0

Re: PHP in a html page?

Oh right, thanks

Martin
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Mar 14th, 2006
0

Re: PHP in a html page?

Quote 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
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Mar 17th, 2006
0

Re: PHP in a html page?

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
Reputation Points: 10
Solved Threads: 0
Junior Poster
martinkorner is offline Offline
102 posts
since Aug 2005
Apr 3rd, 2006
0

Re: PHP in a html page?

You don't link to a page, you just make your existing download page say that.
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
UberAAZ is offline Offline
73 posts
since Oct 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: tomorrow date??? .
Next Thread in PHP Forum Timeline: Looking for an Asset Tracking system





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC