Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="post">
- <input type="submit" name="submit"/>
- </form>
- <?php
- function sendHeaders($file, $type, $name=NULL)
- {
- if (empty($name))
- {
- $name = basename($file);
- }
- header('Pragma: public');
- header('Expires: 0');
- header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
- header('Cache-Control: private', false);
- header('Content-Transfer-Encoding: binary');
- header('Content-Disposition: attachment; filename="'.$name.'";');
- header('Content-Type: ' . $type);
- header('Content-Length: ' . filesize($file));
- }
- if(isset($_POST['submit']))
- {
- $file = 'logo.png';
- if (is_file($file))
- {
- sendHeaders($file, 'image/png', 'My picture.png');
- ob_clean();
- flush();
- @readfile($file);
- exit;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment