Hi. I'm storing an uploaded file into a MySQL database. I want the file to then be downloaded and viewed. Uploading looks like:

<snippet>
if (is_uploaded_file($file) && $filename) {
  $handle = fopen ($file, 'r');
  $resume["data"] = base64_encode (fread ($handle, filesize ($file)));
  fclose($handle);

  $resume["type"] = $_FILES['resume']['type'];
  $resume["size"] = $_FILES['resume']['size'];
}
</snippet>

It loads into the database fine. If it's a word document, it merely spits out plain text. If it's a PDF, it says it can't open it. Downloading looks like:

<snippet>
$app = applications ($_GET["id"]);

header ("Status: 200 OK");
header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Content-Length: ".$app["size"][0]);
header ("Content-Type: ".$app["type"][0]);
header ("Content-Disposition: attachment; filename=Resume-".$app ["full"][0]);

echo $app["resume"][0];
exit;
</snippet>

What am I doing wrong?!! =D Thanks in advance.

~Philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to