473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

displaying a pdf coming out of a mysql-db in a frame

Hi!

I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:

<?php
//output.php4
$sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}";
$result = mysql_query($sql);
$dateien = mysql_fetch_object($result);
$daten = $dateien->Inhalt;
$name = $dateien->Dateiname;
$groesse = $dateien->Groesse;
$typ = $dateien->Typ;

header("Content-type: $typ");
header("Content-length: $groesse");
header("Content-Disposition: attachment; filename=$name");
echo $daten;
?>

My problem is that I get a download dialog where I want to save the pdf but
I want to open it in a fram or iframe like this:
<iframe src="./output.php4?id=129" width="100%" height="400"
name="outputbox">
where id=129 indicates my document.

I get the correct result in Internet Explorer (but not in Opera) if I change
the script like this:

header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=$name");

Does anybody know a solution for Opera? Then I could provide different
scripts depending on the browser.
Or even better a solution working in all browsers?

Thank you very much.

Best wishes

Martin

Jul 17 '05 #1
6 3270
Martin Kirchner wrote:

I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:

<?php
//output.php4
$sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}";
$result = mysql_query($sql);
$dateien = mysql_fetch_object($result);
$daten = $dateien->Inhalt;
$name = $dateien->Dateiname;
$groesse = $dateien->Groesse;
$typ = $dateien->Typ;

header("Content-type: $typ");
header("Content-length: $groesse");
header("Content-Disposition: attachment; filename=$name");
echo $daten;
?>

My problem is that I get a download dialog where I want to save the pdf but
I want to open it in a fram or iframe like this:
<iframe src="./output.php4?id=129" width="100%" height="400"
name="outputbox">
where id=129 indicates my document.

I get the correct result in Internet Explorer (but not in Opera) if I change
the script like this:

header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=$name");


I'd give this a try:

header("Content-type: $typ");
header("Content-Disposition: inline; filename=$name");

No idea whether that'll fix your problem or not though...

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2
Thank you for your answer!
But it doesn't work.
So if anybody has another idea you're welcome!

Best wishes

Martin
Jul 17 '05 #3
Martin Kirchner wrote:
Hi!

I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:

<?php
//output.php4
$sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}";
$result = mysql_query($sql);
$dateien = mysql_fetch_object($result);
$daten = $dateien->Inhalt;
$name = $dateien->Dateiname;
$groesse = $dateien->Groesse;
$typ = $dateien->Typ;

header("Content-type: $typ");
header("Content-length: $groesse");
header("Content-Disposition: attachment; filename=$name");
echo $daten;
?>

My problem is that I get a download dialog where I want to save the pdf but
I want to open it in a fram or iframe like this:
<iframe src="./output.php4?id=129" width="100%" height="400"
name="outputbox">
where id=129 indicates my document.

I get the correct result in Internet Explorer (but not in Opera) if I change
the script like this:

header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=$name");

Does anybody know a solution for Opera? Then I could provide different
scripts depending on the browser.
Or even better a solution working in all browsers?

Thank you very much.

Best wishes

Martin


Here's a link to a clever class file for generating PDF's ... perhaps it
will help you find a solution.

http://www.ros.co.nz/pdf
Jul 17 '05 #4
Doug H wrote:
Martin Kirchner wrote:
Hi!

I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:

<?php
//output.php4
$sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}";
$result = mysql_query($sql);
$dateien = mysql_fetch_object($result);
$daten = $dateien->Inhalt;
$name = $dateien->Dateiname;
$groesse = $dateien->Groesse;
$typ = $dateien->Typ;

header("Content-type: $typ");
header("Content-length: $groesse");
header("Content-Disposition: attachment; filename=$name");
echo $daten;
?>

My problem is that I get a download dialog where I want to save the pdf but
I want to open it in a fram or iframe like this:
<iframe src="./output.php4?id=129" width="100%" height="400"
name="outputbox">
where id=129 indicates my document.

I get the correct result in Internet Explorer (but not in Opera) if I
change the script like this:

header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=$name");

Does anybody know a solution for Opera? Then I could provide different
scripts depending on the browser.
Or even better a solution working in all browsers?


Take a look at www.fpdf.org. We use this pdf creation class in our JAYA123 web
application for small businesses (www.jaya123.com try the demo) . After we
send all the pdf stuff to a file ($fileoutname), the following line seems to
work well at redirection for all browsers.

echo "<HTML><SCRIPT>document.location='$fileoutname ';</SCRIPT></HTML>";

Al C.
__________________________________________________ ________
Adams-Blake Company, Inc.
***
JAYA123 - the web-based total-office system for the
small biz. Order entry, billing, bookkeeping, etc. for $14.95
a month. Perfect for the small business or start-up.
See demo at: http://www.jaya123.com
***
Jul 17 '05 #5
> I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:
A short addition: the pdf-files as well as some as docs and pictures are
stored as binaries in the database. Sorry for the misunderstandings.

Bye Martin

I have a mysql-database with some pdf in it.
I can send them to a webbrowser using this script:

<?php
//output.php4
$sql = "SELECT * FROM tbfiles WHERE tbfiles.ID={$id}";
$result = mysql_query($sql);
$dateien = mysql_fetch_object($result);
$daten = $dateien->Inhalt;
$name = $dateien->Dateiname;
$groesse = $dateien->Groesse;
$typ = $dateien->Typ;

header("Content-type: $typ");
header("Content-length: $groesse");
header("Content-Disposition: attachment; filename=$name");
echo $daten;
?>

My problem is that I get a download dialog where I want to save the pdf
but I want to open it in a fram or iframe like this:
<iframe src="./output.php4?id=129" width="100%" height="400"
name="outputbox">
where id=129 indicates my document.

I get the correct result in Internet Explorer (but not in Opera) if I
change the script like this:

header("Content-type: image/jpeg");
header("Content-Disposition: inline; filename=$name");

Does anybody know a solution for Opera? Then I could provide different
scripts depending on the browser.
Or even better a solution working in all browsers?

Thank you very much.

Best wishes

Martin

Jul 17 '05 #6
.oO(Martin Kirchner)
My problem is that I get a download dialog where I want to save the pdf but
I want to open it in a fram or iframe like this:
[...]

Does anybody know a solution for Opera? Then I could provide different
scripts depending on the browser.
Won't work.
Or even better a solution working in all browsers?


There's no solution. Handling downloaded files is completely up to the
client and depends on the user agent's configuration. Some will open a
PDF "inline" if a plugin is available for that and enabled, others will
prompt the download dialog.

Micha
Jul 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave Posh | last post by:
I seem to be having a problem displaying time stored in mysql. The format stored in the database is 13:15:05. The database data type is time. I'm using asp vbscript and sql to retrieve the time...
15
by: dixie | last post by:
I have a command to open the Access Options dialogue from code: DoCmd.RunCommand acCmdOptions It also opens the Database Window behind it. Is it possible to open the Options without having...
0
by: Matt | last post by:
Hi I'm have difficulty displaying images that are stored in a MySQL database. I've tried using the odbc.net provider, the ByteFX provider and the MySQLDriverCS one but can't seem to get the...
0
by: anjachow | last post by:
The system generated email that are automatically sent displaying well in any web-based mail systems (yahoo, msn, etc...). The foreign characters (vowels with accents and the ñ) aren't displaying...
3
by: Objectifnet | last post by:
Helo, please is there anyone who can help out with this; I have a script that displays details from a MYSQL database and a File Server containing images. Here is the code below: My problem is:...
51
by: kjewell23 | last post by:
Hello, I'm new to this asp.net 2.0 I need help?? My database is coming from AS400 which uses odbc Commands. i have data in the dataset but nothing showing in my gridview. However the data does show...
2
by: Colleen Robledo, MLIS | last post by:
Hello, I'm still pretty new to PHP and MySQL, and have a PHP scripting question. If I'm querying DATE info from a MySQL database, and displaying it with PHP echo statements... is there a PHP...
1
by: gubbachchi | last post by:
Hi, For my project I have a "add" button, upon clicking it, it will take the user to next page where there will be a text box and list of data displayed below it which is fetched from mysql...
2
by: chazzy69 | last post by:
I having trouble displaying information i have retrieved from an mysql database, i succesfully execute the SELECT query as shown below- $sql = "SELECT PCODE,LOCALITY,STATE FROM `postcode` WHERE...
3
by: mvijayrkumar | last post by:
Hi to all.... Guys pls help me..... I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.