Jump to content

Some questions needed to be answered ?


radiations3

Recommended Posts

Q1:

AS we know we can download easily the PDF file from the links like yoursite.com/help.pdf

just like this can we also download the file which is saved in BLOB field

if so then is the folllowing code right for that:

<?php 
mysql_select_db("bakery") or die(mysql_error());
$id=$_GET['id']; // gets the id of the blobfield where the file is saved in database
$file =  mysql_query("SELECT file FROM pic WHERE `Desc`='".$id."'") or die(mysql_error());
$file = mysql_fetch_assoc ($image);
$file = $image ['file'];
header("content-type: application/pdf");
echo $file;
?>

 

Q2:

The above mentioned code is checked with the image and worked correctly I want to know can i use multiple headers in the same file (.php file) to get files of two different data types like

if ($filetype == jpg)

{

header("content-type: image/pdf");

echo $file;

}

if ($filetype == pdf)

{

header("content-type: application/pdf");

echo $file;

}

 

Q3:

Is the following code right for redirecting our page to any specified URL??

if ($help==true) 

 

{

header("location: help/index.php");

}

 

:confused:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.