Avatar of Insoftservice inso
Insoftservice inso
Flag for India asked on

Display pdf without downloading on local m/c

I want to display pdf without downloading the pdf on local server in fancy box.
<?php
	
	$ftp_server="serverip";
	$ftp_user_name = "username"; 
	$ftp_user_pass = "password";
	$conn_id = ftp_connect($ftp_server); 
	$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
	ftp_pasv($conn_id, TRUE);
	
	if ((!$conn_id)) { 
		echo "FTP connection failed";
		exit; 
	} 
	else {
		//echo "Connected to $ftp_server";
	}
	//$list=ftp_nlist($conn_id, "");
	foreach (ftp_nlist($conn_id, "") as $element) 
	{
		echo "<a class='fancypdf' data-fancybox-type='iframe' href='ftp://varun:varun123@serverip/$element'>". $element ."</a></br>";
	}
	
	
	
	
	
	
	ftp_close($conn_id);
?>
<html>
<head>
	<script type="text/javascript" src="fancybox/lib/jquery-1.10.1.min.js"></script>
	<script type="text/javascript" src="fancybox/source/jquery.fancybox.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="fancybox/source/jquery.fancybox.css?v=2.1.5" media="screen" />
	
	<script type="text/javascript">
		$(document).ready(function(){
			$(".fancypdf").fancybox({
                'frameWidth': 680,
                'frameHeight':495,
                'overlayShow':true,
                'hideOnContentClick':false,
                'type':'iframe'
			});
		});
	</script>
</head>
</html>

Open in new window

PHPjQuery

Avatar of undefined
Last Comment
Insoftservice inso

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Insoftservice inso

ASKER
Do you mean to say @ray that above method is downloading on local server and later deleting it.
If yes then can where actually its saving on client mc

sorry my mistake it gets stores on the server where script is written please correct me if i am wrong. I hope even if it gets downloaded on server side it has no issue thx.
SOLUTION
Jim Riddles

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Insoftservice inso

ASKER
thx
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck