Accessed as such: http://localhost/forcedownload.php?file=../images/mustdownload.jpg
<?php
$filename = $_GET[’file’];
//check for existence of file first if not there die.
if(!file_exists($filename))
{
exit();
//for testing:
//die(’Error: File not found.’);
}
//could be used to test to make sure that only files from a particular directory are accessed
$baseurl = str_replace($DOCUMENT_ROOT, ”, dirname($filename));
$fileextension = strtolower(substr(strrchr($filename,’.’),1));
//make sure that we are only trying to download files with an image extension. An […]
php's archives
Force File Download
Posted by Bowie van Ling in July 16th 2008
About the author
Bowie van Ling is a multimedia developer currently living and working in Asheville, North Carolina. A summary of his skill set can be found on Linked In Bowie also finds it odd to write about himself from a third person perspective.
Search
Categories
- Uncategorized (1)
- as3 (3)
- swfobject (1)
- OOP (1)
- actionscript (2)
- sound (1)
- physics (2)
- Math (1)
- Vector Geometry (1)
- Papervision 3D 2.0 (1)
- php (1)
Archives
- July 2008 (1)
- June 2008 (1)
- May 2008 (1)
- April 2008 (3)