Download files from your server through browser – Simple PHP Script

-Below are give two small scripts, one is HTML and other is PHP.

-Paste below piece of code in a “input.html” file

<form action=”download.php” method=”post”>
<h2>Enter File Name </h2>
<input type=”text” name=”filename” size=”150″>
<input type=”submit” value=”submit”>

-Paste below piece of code in a “download.php” file

header(‘Content-Description: File Transfer’);
header(‘Content-Type: application/php’);

-Save this above 2 files on your server’s root directory->and access them via browser.

For e.g –

For Input Path – /app/etc/modules (the path after /path/to/your/website_root_directory/)

  • Luke

    This is a terrible idea. What’s stopping me from posting a filename of “../../../../etc/passwd”?