Re: Displaying files

From: Date: Fri, 15 Aug 2008 13:26:27 +0000
Subject: Re: Displaying files
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-278131@lists.php.net to get a copy of this message
> > Because as I mentioned before PHP runs as a different user to your >> browser. >> >> -Stut > > Stut, Are you referring to this? "If you're using IIS then it's the IUSR_machine user which doesn't have access to the network by default" The IUSR_SERVERNAME account is what it should be connecting as whether I'm using PHP/Javascript/HTML, unless specifically set in a connection string such as the database connections. But, the initial calls always come from IUSR_SERVERNAME. Thiago, HTML WORKS <a href=\\server\folder\file.xls target="_blank">Open</a> Javascript WORKS function openWin(folder,file) { var LeftPosition = (this.screen.width) / 2; var TopPosition = (this.screen.height) - this.screen.height; var Height = (this.screen.height) - 90; var Width = (this.screen.width) /2 - 10; MyWin = window.open(\\\\server\\"+folder+"\\"+file+"\.xls","ViewImage","scrollbars=yes, status=yes, resizable=no,top="+TopPosition+",left="+LeftPosition+",width="+Width+",height="+Height+""); MyWin.focus(); } PHP DOESN'T WORK $filename = "\\\\server\\".$folder."\\".$file.".xls"; header("Content-Type: application/x-msdownload"); readfile($filename); I put all three of these examples into the exact same page. The HTML and Javascript open the file without any problems, but PHP cannot open it.

« previous php.general (#278131) next »