What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » How do you make a php file a download?

How do you make a php file a download?
Author: Message:
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. How do you make a php file a download?
Ok i have a site and i want people to download a php script. But if i link to it the people get bunch of gibberish. how do i get  them to download the script?
03-20-2005 10:34 AM
Profile PM Web Find Quote Report
Ahmad
Senior Member
****

Avatar
@hmad

Posts: 526
Reputation: 27
40 / Male / –
Joined: Dec 2004
RE: How do you make a php file a download?
One option is to put it in a zip file.
03-20-2005 10:38 AM
Profile PM Web Find Quote Report
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. RE: How do you make a php file a download?
hmm i dont want to go through that trouble. Its annoying to put a 1 kb zip. whats the other options?
03-20-2005 10:42 AM
Profile PM Web Find Quote Report
Millenium_edition
Veteran Member
*****

Avatar

Posts: 1787
Reputation: 57
Joined: Apr 2003
RE: How do you make a php file a download?
quote:
Originally posted by Hobbes
hmm i dont want to go through that trouble. Its annoying to put a 1 kb zip. whats the other options?
if that's trouble, then you shouldn't have a webspace on your hands ¬¬
03-20-2005 10:45 AM
Profile E-Mail PM Find Quote Report
John Anderton
Elite Member
*****

Avatar

Posts: 3908
Reputation: 80
37 / Male / Flag
Joined: Nov 2004
Status: Away
RE: How do you make a php file a download?
quote:
Originally posted by Hobbes
But if i link to it the people get bunch of gibberish

Is your host a php supporting one ^o)

quote:
Originally posted by Hobbes
hmm i dont want to go through that trouble. Its annoying to put a 1 kb zip. whats the other options?
Its just a zip :undecided:
Rar it :dodgy: :P
U could make it a txt and when ppl open it, tell em to copy the text completely, open notepad, paste it and then save it as .php
(In the save as box, unselect the text file option and keep it on all files then type the extension yourself)
[

KarunAB.com
]

[img]http://gamercards.exophase.com/459422.png[
/img]
03-20-2005 11:22 AM
Profile E-Mail PM Web Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: How do you make a php file a download?
You can save it as .phps (s = source) which shows them syntax-highlighted source code and the script isn't parsed..
The previous sentence is false. The following sentence is true.
03-20-2005 11:39 AM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: How do you make a php file a download?
quote:
Originally posted by Segosa
You can save it as .phps (s = source) which shows them syntax-highlighted source code and the script isn't parsed..
and if your server dosnt support that use a script like this

code:
<?

$file = $_GET['file'];
if(isset($file)){
$file = "./$file";
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=$file");

$pic = fopen($file,'r');
$php = fread($pic,filesize($file));
fclose($pic);
echo $php;

}else{
echo "blah";
}

?>


which will take ?file=filename  on the url then ask the user if they wish to download the file , this will only download files from the same directory the script is in.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-20-2005 11:46 AM
Profile PM Web Find Quote Report
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. RE: How do you make a php file a download?
-dt- i dont really understand what you are saying

can u put it in step to step instructions
Thanks
03-20-2005 01:10 PM
Profile PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / Male / Flag
Joined: Mar 2004
RE: How do you make a php file a download?
step1: copy and paste my code into notepad and save it as "phpdl.php"

step2: upload it to a directory on your server

step3: move the files you want to show the source of into that folder

step4: to download that script use http://yoururl/phpdl.php?file=scriptfilename

that should work :P
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-20-2005 01:14 PM
Profile PM Web Find Quote Report
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. RE: How do you make a php file a download?
well -dt- THANKS A BUNCH!!!

Lee helped me work out the technical problems! But thanks for the script :P
03-20-2005 01:29 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On