File: upload_handler.php

package info (click to toggle)
postfixadmin 2.3.5-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,200 kB
  • sloc: php: 25,767; xml: 14,485; perl: 964; sh: 664; python: 169; makefile: 84
file content (18 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
    function show($name) {
        @unlink(dirname(__FILE__) . "/temp/$name");
        @move_uploaded_file($_FILES[$name]['tmp_name'], dirname(__FILE__) . "/temp/$name");
        $unsafe = @file_get_contents(dirname(__FILE__) . "/temp/$name");
        $safe = htmlentities($unsafe);
        $handle = fopen(dirname(__FILE__) . "/temp/$name", 'w');
        fwrite($handle, $safe);
        fclose($handle);
        print $safe;
    }
?><html>
    <head><title>Test of file upload</title></head>
    <body>
        <p><?php show('content'); ?></p>
        <p><?php show('supplemental'); ?></p>
    </body>
</html>