Archive for November 2009

Customized File Download in PHP

<?
if($_GET['action']==”download”){
$file = “./images/”.$_GET['filename'].”.”;
header(“Content-type: application/force-download”); //optional
header(“Content-Transfer-Encoding: Binary”);
header(“Content-length: “.filesize($file));
header(“Content-Disposition: attachment; filename=”.basename($file).”");
readfile(“$file”);
}else{
$folder = “./images/”;
if (is_dir($folder)){
$contents = scandir($folder);
$bad = array(“.”, “..”, “.DS_Store”, “_notes”, “Thumbs.db”);
$files = array_diff($contents, $bad);
}
echo<<<FILES
?>
<table>
<?
FILES;
while(list($key,$value) = each($files)){
$rCtr++;
echo<<<FILES
?>
<tr><td align=”right”>$value</td>
<td><img src=”images/download.png”
onmousedown=”window.open(‘$PHP_SELF?action=download&filename=$value’,'_self’)”
style=”cursor:pointer” /></td></tr>
<?
FILES;
}
?>
</table>
<?
}
?>

<?

if($_GET['action']==”download”){

$file = “./images/”.$_GET['filename'].”.”;

header(“Content-type: application/force-download”); //optional

header(“Content-Transfer-Encoding: Binary”);

header(“Content-length: “.filesize($file));

header(“Content-Disposition: attachment; filename=”.basename($file).”");

readfile(“$file”);

}else{

$folder = “./images/”;

if (is_dir($folder)){

$contents = scandir($folder);

$bad = array(“.”, “..”, “.DS_Store”, “_notes”, “Thumbs.db”);

$files = array_diff($contents, $bad);

}

echo<<<FILES

?>

<table>

<?

FILES;

while(list($key,$value) = each($files)){

$rCtr++;

echo<<<FILES

?>

<tr><td align=”right”>$value</td>

<td><img src=”images/download.png”

onmousedown=”window.open(‘$PHP_SELF?action=download&filename=$value’,'_self’)”

style=”cursor:pointer” /></td></tr>

<?

FILES;

}

?>

</table>

<?

}

?>

PHP File Download

<?php

// place this code inside a php file and call it f.e. "download.php"
$path = $_SERVER['DOCUMENT_ROOT']."/path2file/"; // change the path to fit your websites document structure
$fullPath = $path.$_GET['download_file'];

if ($fd = fopen ($fullPath, "r")) {
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
        case "pdf":
        header("Content-type: application/pdf"); // add here more headers for diff. extensions
        header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download
        break;
        default;
        header("Content-type: application/octet-stream");
        header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    }
    header("Content-length: $fsize");
    header("Cache-control: private"); //use this to open files directly
    while(!feof($fd)) {
        $buffer = fread($fd, 2048);
        echo $buffer;
    }
}
fclose ($fd);
exit;
// example: place this kind of link into the document where the file download is offered:
// <a href="download.php?download_file=some_file.pdf">Download here</a>
?>

List of Passers PSU – Lingayen College Admission Test

List of Passers PSU – Lingayen College Admission Test
Date of Exam: November 5 & 6, 2009

1      ARESPI, Mary Grace C.
2      BRAVO, Mark Jayson Z.
3      CACATIAN, Jan paul F.
4      CARIG, Ali-Rose
5      CASTILLO, Clarissa A.
6      CASTILLO, Kaye One J.
7      CORRE, Michelle Joy
8      DE GUZMAN Jr, Alfredo M.
9      DOMAGAS, Kevien Allan E.
10    ENOR, Jenny Lyn P.
11    FERRER, Janet S.
12    FRONDA, Ma. Kristina B.
13    GAPASIN, Marilyn J.
14    IGNACIO, Erish Yvonne M.
15    LOPEZ, Remzceil C.
16    MANAOIS, Charito B.
17    MANAOIS, Charles B.
18    MEGU, VANESSA L.
19    MENDEGORIN, Christine M.
20    MOLINO, Mona Marie V.      no pic submitted
21    ORAZA, Joel M.
22    PASAGOY, Josua A.
23    PERALTA, Stephen Jan D.
24    PEREZ, JAYLA JOY C.
25    RAMOS, Gembert R.    no pic submitted
26    RIVERA, Ryan M.
27    SOTELO, Rochelle P.
28    TOMAS, Robert V.
29    ULANDAY, Maria Christine R.
30    VALLEJOS Jr., Luther Carl P.
31    VERGARA, Rachelle C.
32    VIRGO, Catherine I.

*** Please get your passer slip at the Guidance Office before proceeding for evaluation and enrollment

Please scroll down for the requirements and evaluation procedure