Pages

Monday, 8 February 2016

php file download script to download any file

PHP file download script to download any file:


Usage : in above href you have to change "<?php echo $filepath; ?>" the following code with your file path, by this script you can download all types of files like documents, ext, videos, images, zip files etc..

Check Out here:

  • There is a security problem, should closed "application/force-download" Content-Type! which can download anything including server PHP source!.
  • To get around the security problem, don't take absolute or relative path information from the request; only get the file name. Strip the path, e.g using $file = pathInfo($_GET['file'] and then assemble the path by appending some known path with $file['basename']. If you need to provide files from various folders, use path tokens in your request, which you then map to the actual path in your download function.

No comments:

Post a Comment