Exemplo n.º 1
0
            $info = finfo_open(FILEINFO_MIME);
            $type = finfo_file($info, $path);
            finfo_close($info);
        }
    }
    if ($type == '') {
        $type = "application/force-download";
    }
    // Set Headers
    // echo $file;
    header("Content-Type: {$type}");
    header("Content-Disposition: attachment; filename={$file}");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " . $size);
    // Download File
    readfile($path);
    $descargas->insertarRegistro(array("codvideo" => "{$codvideo}", "tipo" => "'{$tipo}'"));
} else {
    die("No existe el archivo!!");
}
/*
$archivo=$vid['video']; 
header("Pragma: public"); 
header("Expires: 0"); // set expiration time 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
header("Content-Type: application/force-download"); 
header("Content-Type: application/octet-stream"); 
header("Content-Type: application/download"); 
header("Content-Disposition: attachment; filename=Ronald_Nina_;"); 
header("Content-Transfer-Encoding: binary"); 
header("Content-Length: ".filesize($arch)); */