Example #1
0
if ($blogin) {
    $filename = "";
    $error = 0;
    try {
        if (isset($_GET["filename"])) {
            $filename = $_GET["filename"];
        } else {
            if (isset($_POST['filename'])) {
                $filename = $_GET["filename"];
            } else {
                $result = array('error' => -2);
            }
        }
        if ($filename) {
            $filename = trim($filename, '\'');
            $filename = dealPath($_SERVER['DOCUMENT_ROOT'] . "/" . $filename);
            if (file_exists($filename)) {
                if (ini_get('zlib.output_compression')) {
                    ini_set('zlib.output_compression', 'Off');
                }
                header('Content-Description: File Transfer');
                header('Content-Type: application/octet-stream');
                header('Content-Disposition: attachment; filename=' . basename($filename));
                header('Content-Transfer-Encoding: binary');
                header('Expires: 0');
                header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
                header('Pragma: public');
                header('Content-Length: ' . filesize($filename));
                ob_clean();
                flush();
                readfile($filename);
Example #2
0
 * and no reference to it have to be done;
 *     No references to webfmt have to be done in any file distributed with your product;
 *     The source code of webfmt doesn’t have to be distributed alongside with your product;
 *     You can remove any file from webfmt when integrating it with your product.
 * The CDL is a lifetime license valid for all releases of webfmt published during
 * and before the year following its purchase.
 * It's valid for webfmt releases also. It includes 1 year of personal e-mail support.
 *
*****************************************************************************/
require_once "base.php";
if (isset($_GET["params"])) {
    $params = urldecode($_GET["params"]);
    if ($params) {
        $params = (array) json_decode($params);
        try {
            $image = dealPath($_SERVER['DOCUMENT_ROOT'] . $params["url"]);
            $thumb_width = $params["width"];
            $thumb_height = $params["height"];
            $info = array();
            $info['size'] = filesize($image);
            $imageinfo = getimagesize($image);
            if ($imageinfo) {
                $info['width'] = $imageinfo[0];
                $info['height'] = $imageinfo[1];
            }
            $info['width_height'] = $imageinfo[3];
            $info['mime'] = $imageinfo['mime'];
            unset($imageinfo);
            $imageinfo = pathinfo($image);
            $info['path'] = $imageinfo['dirname'] . '/';
            $info['type'] = strtolower($imageinfo['extension']);
Example #3
0
 $filename = substr($file_path["basename"], 0, strrpos($file_path["basename"], "."));
 $ext = strtolower($file_path["extension"]);
 if (in_array($ext, $config["allowfiletype"])) {
     if ($config["autorename"]) {
         if ($config["filenamefun"]) {
             $fun = $config["filenamefun"];
             $newfile = $fun($ext);
         } else {
             $newfile = date("Ymd") . uniqid() . "." . $file_path["extension"];
         }
     } else {
         $newfile = $file_path["basename"];
     }
     //$newfile = base64_encode($filename) . "." . $file_path["extension"];
     //echo $newfile;
     $target_path = dealPath($_SERVER['DOCUMENT_ROOT'] . $dir . "/" . $newfile);
     if (!file_exists($target_path)) {
         $allowsave = true;
         if ($config["beforesave"]) {
             $fun = $config["beforesave"];
             $allowsave = $fun($file_path["basename"], $ext);
         }
         if ($allowsave) {
             $result = $uploader->save($target_path, $file);
             if ($config["aftersave"]) {
                 $fun = $config["aftersave"];
                 $fun($target_path, $newfile, $ext);
             }
         } else {
             $result = array('error' => -9);
         }