Avatar of freestate
freestate asked on

How to display Word doc stored in MySQL BLOB within an IFRAME

I have just taken on a new client who runs a recruitment company.  They have a database of thousands of candidates, all of whom have Word doc CVs stored in a Blob in a MySQL database.

Currently, the option to download the CV is available for each candidate, but I would like to display the CV within a scrollable IFRAME on each candidates profile.

However, I can't find anything anywhere that will show me how this can be achieved.

The client uses IE6, and has Word installed, and so my thinking is that if I can get to a point where I can:

<iframe src="CV12345.doc"></iframe> then all will be well.

However, I can't work out how to do this without creating a copy of the CV as a word doc on the server (which defeats the purpose of putting it in a blob in the first place...)

The code currently used is shown below, but this simply gives the 'do you want to open or save' download box.
$result = mysql_query($sql);
  $data = mysql_result($result, 0, "cvfile");
  $name = mysql_result($result, 0, "cvupload"); 
  $type = mysql_result($result, 0, "cvtype"); 
  $size = mysql_result($result, 0, "cvsize"); 
  
	
  header("Content-type: $type");
  header("Content-length: $size");
  header("Content-Disposition: attachment; filename=\"$name\"");
  header("Content-Description: PHP Generated Data");
  echo $data;

Open in new window

PHP

Avatar of undefined
Last Comment
hielo

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
hielo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes