Download a .php file?

Started on the old forum in December 2011 · view the original in the archive · old links redirect here

3 replies · 429 views · started 14 years ago · 1 min read

4 participants
usama742 Developer · 74 posts #1

is it possible to download a .php file directly?

bdnetwork Developer · 102 posts #2

Yes 4m ur hosting file manager or ftp 😛 bt n0t 4m externel site.

ionutvmi Junior · 45 posts #3
<?php
$file = 'file.php'; // name of the file you want to download

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>

PIMP-WAP.NET - PIMP YOUR MOBILE

MASTER-LAND.NET - WAPMASTERS LAND

kei_ki7 Senior · 431 posts #4

Yes, by using force download. But of course you need to set it up first.

Did I help you? You can help me too Your donations will help me finance my studies.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close