Getfile Getfile1.4 Documentation

Welcome to Getfile - a single file, PHP powered download handler and logging script with hotlink protection.

You will need PHP: Hypertext Preprocessor version 4.x or above installed on your server in order to use this script.

To view directions for each step, click on the headers. Please review every section.

Configuration

Upload download.php to your server. To configure Getfile to work for your site, you must first open the file and edit the settings on the first half of the page.

Using Getfile

Understanding Hotlinking and Bandwidth Theft

"Hotlinking" (also called "leeching" and "bandwidth theft") is a term referring to when a web page of one website owner is direct linking to the images or other multimedia files on the web host of another website owner, usually without permission. This not only causes the host of the hotlinked file to use his bandwidth for data tranfers occuring on another's site, but often in many cases it is intellectual property theft. With Hotlink Protection turned on, you can block out all unwanted domains. Only the people in your allowed-domains list will be able to have access to the files in your download folder.

Organizing Downloads on Your Site

For Getfile to serve the downloads on your site, they need to be uniquely named and located in the downloads folder that you set when you configured the script. Even though all of your download files need to be located in the downloads folder, they can still be organized within that folder. For Example, the downloads folder is set to "downloads/", but the folder is organized like so:

downloads/reports/2007/
downloads/reports/2006/
downloads/programs/games/
downloads/programs/office/
downloads/forms/

Even though your files are in subfolders, as long as they are in your download folder and are uniquely named they can be located by the script with no extra effort. So even though "project_report.doc" is in the "downloads/reports/2007/" folder, when you link to the download "download.php?progress_report.doc", the script will still find your document.

NOTE: In order for Getfile to serve your files properly, they all NEED to be uniquely named from all files in the downloads folder, including subfolders. If more than one file has the same name, Getfile will serve the first file that fits, which may not be the desired file. For example, if you have two files named "progress_report.doc" in "downloads/reports/2006/" and "downloads/reports/2007/", and "project_report.doc" is in the "downloads/reports/2007/" folder, when you link to the download "download.php?progress_report.doc" is meant to fetch the report in the 2007 folder, if the the 2006 folder is checked first, that is the file that'll reach the user when they download it. To avoid this and make the process simple, simply add dates into the names of the files (like "progress_report0206.doc"). You can even still have the user download the file as "progress_report.doc" regardless with Getfile's Download As New Name feature.

Download File

To use the script to put a download on your website, simply add a link onto your website:

<a href="http://www.yourdomain.com/download.php?example.zip">Download example.zip</a>

Using Encrypted Filenames

When ENCRYPT_FILENAME is enabled, you can use MD5 encrypted names in your URLs to retrieve files. This is useful when you want to disguise the original name of the file you're delivering. While in the admin panel, with ENCRYPT_FILENAME enabled, there is a built in tool to help you encrypt the desired filename. Rather than using:

<a href="http://www.yourdomain.com/download.php?example.zip">Download example.zip</a>

Your URL will be:

<a href="http://www.yourdomain.com/download.php?9ae68719184d087ebd6c4e6f6a8ae51a">Download example.zip</a>

Download File as New Name

You can use the script to force the user to download a file under a new name without renaming the original file. Create a link like the one above, add a slash ( "/" ), and then type the new name of the file:

<a href="http://www.yourdomain.com/download.php?example.zip/newname.zip">Download newname.zip</a>
<a href="http://www.yourdomain.com/download.php?9ae68719184d087ebd6c4e6f6a8ae51a/newname.zip">Download newname.zip</a>

When the user clicks on the link, s/he will download newname.zip, but the file will still be example.zip.

Managing the Download Log

Checking the Log Through the Web

When you enable LOG_DOWNLOADS, all downloads processed by Getfile are logged into tab-delimited text file. You can view the log online through Getfile. Simply type this URL into your browser:

http://www.yourdomain.com/download.php?admin

For the greatest level of security, Getfile uses HTTP authentication to protect the panel. The username and password are the ones you configured into the script. In this view, the data is organized neatly into an HTML table. From this view, you can also export and clear the log with the Export Log and Clear Log buttons at the top of the page. NOTE: Clearing the log deletes the logged data off the server, not just the page. You cannot recover your log data after you've cleared it.

Viewing the Exported Log Data

Since the data is exported to a tab-delimited text file, the log can be viewed in an ASCII editor or word processor like Notepad, Wordpad, and Microsoft Word. The file is also supported by most spreadsheet programs like Excel. To import while using Excel, click File > Open..., change File Type to Text Files, and select your data log. A wizard will come up with alot of options, but Excel will intuitively know how to read the data. Simply press Finish on the wizard and your data will be put in it's correct cells for you to use with your documents, statistics, and presentations.

Customizing Download Log in Web View

You can customize the way your log data is presented while viewing it on the web by modifying the code in the LOG_CSS portion of the script. You can change the way the BODY, THEAD, TABLE, TR, and TD and selectors work. The CSS code included shows all of the tags used in the log view, and you can easily customize the look of the log to your liking. If you need help on figuring out what CSS is and how to use it, take a look at some CSS Tutorials at http://www.w3schools.com/css/css_intro.asp.

Additional Info