/    Sign up×
Community /Pin to ProfileBookmark

file download problem….

Hi,

I just cannot download ! My goal is to offer my visitors different downloads (zip for now) and hide the real download address (on an external server). I put up a little script, it seems to work but the downloaded files are just 3 bytes long (while they should be more than 30kb long)!

What is wrong then ?

Thanks for any help !

[code=php]<?

$name = “myfile.zip” //or .rar
$gogo = ‘Content-Disposition: attachment; filename=”‘.$name.'”‘;

$add=”http://www.myothersite.com/”.$name;

$content_len=@filesize($add);
Header(“Content-type: application/zip”);
Header(“Content-type: octet-stream”);
Header($gogo);
if($content_len!=FALSE)
{
Header(“Content-length: $content_len”);
}
readfile($add);

?>[/code]

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@NightShift58Feb 10.2007 — See this example, which does it slightly differently - Header($gogo) :

http://www.php.net/manual/en/function.readfile.php#68977
×

Success!

Help @patimages spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...