troubleshooting Question

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

Avatar of freestate
freestate asked on
PHP
1 Comment1 Solution1365 ViewsLast Modified:
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;
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros