swf文件存储在数据库中,需要使用flecepep.显示。
这是萤光显示文件的代码.
$('#documentViewer').FlexPaperViewer(
{ config : {
SWFFile : '<?php echo "present_retrieve.php?id=".$id.""; ?>',
Scale : 0.6,
ZoomTransition : 'easeOut',
ZoomTime : 0.5,
ZoomInterval : 0.2,
FitPageOnLoad : true,
FitWidthOnLoad : false,
FullScreenAsMaxWindow : false,
ProgressiveLoading : false,
MinZoomSize : 0.2,
MaxZoomSize : 5,
SearchMatchAll : false,
InitViewMode : 'Portrait',
RenderingOrder : 'flash',
StartAtPage : '',
ViewModeToolsVisible : true,
ZoomToolsVisible : true,
NavToolsVisible : true,
CursorToolsVisible : true,
SearchToolsVisible : true,
WMode : 'window',
localeChain: 'en_US' }}present_retrieve.php
<?php
// Connect to the database
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="is"; // Database name
$tbl_name="presentation"; // Table name
$conn = mysql_connect("$host", "$username", "$password");
if(! $conn )
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_name);
if (isset($_GET["id"]) && !empty($_GET["id"])) {
$id= $_GET['id'];
$query = "SELECT file_name, file_type, file_size, content FROM $tbl_name WHERE file_id = '$id'";
$result = mysql_query($query) or die(mysql_error());
$row1 = mysql_fetch_array($result);
$name=$row1['file_name'];
$type=$row1['file_type'];
$size = $row1['file_size'];
$content = $row1['content'];
header("Content-length: $size");
header("Content-type: $type");
header("Content-Disposition: attachment; filename=$name");
echo $content;
mysql_close($conn);
exit;
}
?>然而,文件并没有显示在中。
请帮我弄清楚。谢谢。
发布于 2014-04-17 02:14:39
这可能是在输出中有一个额外的空间,这会破坏swf文件。检查php脚本中的任何前导或尾随空格(在php脚本标记之外)。
您也不需要在您的响应中的内容配置头。我建议swf文件的头文件如下:
标题(“内容-类型:应用程序/x-冲击波-闪光灯”);标题(“接受-范围:字节”);标题(“内容-长度:”)。$size);
https://stackoverflow.com/questions/23103986
复制相似问题