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

LVL 15
InsoftserviceAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Anything and everything that is displayed on a computer screen has been downloaded to the computer, full stop.  It may be deleted later, by the client, but if it's ever visible that is because it has been downloaded and displayed.  If you want it to be displayed it must be downloaded.  If you do not want it stolen, copied, repurposed, modified or retransmitted, do not put it online at all.  This is not a fancybox issue - it's just the way all client/server systems work.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
InsoftserviceAuthor Commented:
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.
0
Jim RiddlesPrepress/OMS SpecialistCommented:
It sounds like there might be a mis-communication here.  I believe you simply want to display links to PDFs without actually having the PDFs on your local server that is serving the web page.  Is that correct?

If so, then what you have written should work as you are expecting.  Your code connects to a FTP server, retrieves the list of available files and creates an anchor element with a reference to that file.

If, however, you are trying to prevent your end-users from downloading the PDF and only viewing it in their browser, then Ray is correct, and that won't work with your solution.
0
InsoftserviceAuthor Commented:
thx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.