I'm using following code to open a PDF document from database. My problem is the PDF document is opened in the current tab but I want it to open in a new tab instead.
$query = "SELECT name, type, size, content FROM files WHERE id = '$id'";
$result = mysql_query($query) or die('Error, query failed');
list($name, $type, $size, $content) = mysql_fetch_array($result);
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: inline; filename=$name");
echo $content;
I'm using redactor wysiwyg
to add the PDF. Let me know if you need more info, thank you.
Solved my problem to open the PDF in new tab. We can't open new tab by using php code. Only can do it by adding the "target="_blank" in
redactor.js
Following is part of the code from redactor WYSIWYG. You can found the "target="_blank" inside the code.
For more information, please get the code from redactor WYSIWYG website.