Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 4:34 PM To: Boyd, Todd M. Cc: php-general@lists.php.net Subject: Re: [PHP] Displaying files On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote: -Original Message- From: Stut [mailto:[EMAIL

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Okay, I'm perplexed! If I put the exact same value into a javascript function and open a window the document comes up perfectly fine. But, when trying to readfile() copy() or fopen() in PHP I get the failed to open stream: error. Any idea why the exact same link would open fine using a HTML

Re: [PHP] Displaying files

2008-08-15 Thread Stut
On 15 Aug 2008, at 14:07, Dan Shirah wrote: Okay, I'm perplexed! If I put the exact same value into a javascript function and open a window the document comes up perfectly fine. But, when trying to readfile() copy() or fopen() in PHP I get the failed to open stream: error. Any idea why

Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Okay, I'm perplexed! If I put the exact same value into a javascript function and open a window the document comes up perfectly fine. But, when trying to readfile() copy() or fopen() in PHP I get the failed to open stream: error. Any idea

Re: [PHP] Displaying files

2008-08-15 Thread Stut
: -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 4:34 PM To: Boyd, Todd M. Cc: php-general@lists.php.net Subject: Re: [PHP] Displaying files On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote: -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
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

Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Thiago, HTML WORKS a href=\\server\folder\file.xls target=_blankOpen/a Javascript WORKS function openWin(folder,file) { var LeftPosition = (this.screen.width) / 2; var TopPosition = (this.screen.height) - this.screen.height; var

Re: [PHP] Displaying files

2008-08-15 Thread Stut
On 15 Aug 2008, at 14:26, Dan Shirah wrote: 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

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Wow, I think it finally clicked. Sorry that took so long. The whole point behind using PHP was to try and copy or call the file from the server side so the user does not see the path to the document. Using HTML and Javascript it is extrememly easy to just view source and see the path. Whereas

Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah [EMAIL PROTECTED] wrote: Wow, I think it finally clicked. Sorry that took so long. That's fine, sorry if I sounded rude or something. I didn't mean it. The whole point behind using PHP was to try and copy or call the file from the server side so the user does not

Re: [PHP] Displaying files

2008-08-15 Thread Jason Pruim
On Aug 15, 2008, at 9:57 AM, Dan Shirah wrote: Wow, I think it finally clicked. Sorry that took so long. The whole point behind using PHP was to try and copy or call the file from the server side so the user does not see the path to the document. Using HTML and Javascript it is

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
What about using some type of a dispatch script? Locate all the files outside of the doc root and then just call: viewdocument.php?ID=12345678 ? Although now that I've typed that I realize that you would still be running the same issue.. Unless you used javascript in your PHP to call the file

Re: [PHP] Displaying files

2008-08-15 Thread Stut
On 15 Aug 2008, at 15:17, Dan Shirah wrote: What about using some type of a dispatch script? Locate all the files outside of the doc root and then just call: viewdocument.php? ID=12345678 ? Although now that I've typed that I realize that you would still be running the same issue.. Unless

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Your best bet would be to run a periodic sync to copy the files across from the other server but it would have to run outside the IIS process. There are plenty of solutions around for doing this and they have nothing to do with PHP. You can then refer to the local copy of the file from PHP

Re: [PHP] Displaying files

2008-08-15 Thread Stut
On 15 Aug 2008, at 15:41, Dan Shirah wrote: Your best bet would be to run a periodic sync to copy the files across from the other server but it would have to run outside the IIS process. There are plenty of solutions around for doing this and they have nothing to do with PHP. You can then

Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
A scheduled task is messy. IIWY I'd use FTP to pull the file over, but that's still pretty messy. If this is an Intranet then the risks involved in giving that user access to the network is minimal and probably would be the best solution. Alternatively you could set up an HTTP server on the

Re: [PHP] Displaying files

2008-08-15 Thread Philip Thompson
On Aug 14, 2008, at 3:29 PM, Dan Shirah wrote: You need to know the mime type for the file you're serving. Call header('Content-Type: x/y'); where x/y is the mime type. Then call readfile('/path/to/file/on/server'); to output the file to the browser. -Stut Stut, trying that method

Re: [PHP] Displaying files

2008-08-14 Thread Jim Lucas
Dan Shirah wrote: I think this should be a simple question and answer, but after looking through the manual and goggling I have yet to find an answer. Question: Using PHP, how would I go about opening a file in a window, table or div? Example: I have a file called 123.xls. When a condition is

Re: [PHP] Displaying files

2008-08-14 Thread Dan Shirah
Who needs PHP... :) The following will open a new browser window and load the href in it. a href=http://examples.com/123.xls; target=_blankOpen It!!!/a If that isn't what you are looking for, please give a little more details. You're killin' me, Jim! :) I need to open the file from the

Re: [PHP] Displaying files

2008-08-14 Thread Stut
On 14 Aug 2008, at 21:06, Dan Shirah wrote: Who needs PHP... :) The following will open a new browser window and load the href in it. a href=http://examples.com/123.xls; target=_blankOpen It!!!/a If that isn't what you are looking for, please give a little more details. You're

Re: [PHP] Displaying files

2008-08-14 Thread Dan Shirah
You need to know the mime type for the file you're serving. Call header('Content-Type: x/y'); where x/y is the mime type. Then call readfile('/path/to/file/on/server'); to output the file to the browser. -Stut Stut, trying that method gives me the following: PHP Warning: readfile(

Re: [PHP] Displaying files

2008-08-14 Thread Stut
On 14 Aug 2008, at 21:29, Dan Shirah wrote: You need to know the mime type for the file you're serving. Call header('Content-Type: x/y'); where x/y is the mime type. Then call readfile('/path/to/file/on/server'); to output the file to the browser. -Stut Stut, trying that method gives me

Re: [PHP] Displaying files

2008-08-14 Thread Dan Shirah
That simply means it can't open the file. Make sure the machine this is running on has everything it needs to access that UNC filename. -Stut Stut, If I copy the link from the error message and paste it into a browser running from my PHP server, the file comes up just fine. Should I try

Re: [PHP] Displaying files

2008-08-14 Thread Stut
On 14 Aug 2008, at 21:57, Dan Shirah wrote: That simply means it can't open the file. Make sure the machine this is running on has everything it needs to access that UNC filename. -Stut Stut, If I copy the link from the error message and paste it into a browser running from my PHP

RE: [PHP] Displaying files

2008-08-14 Thread Boyd, Todd M.
-Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 4:21 PM To: Dan Shirah Cc: PHP-General List Subject: Re: [PHP] Displaying files On 14 Aug 2008, at 21:57, Dan Shirah wrote: That simply means it can't open the file. Make sure the machine

Re: [PHP] Displaying files

2008-08-14 Thread Stut
On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote: -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 4:21 PM To: Dan Shirah Cc: PHP-General List Subject: Re: [PHP] Displaying files On 14 Aug 2008, at 21:57, Dan Shirah wrote: That simply means it can't

RE: [PHP] Displaying files

2008-08-14 Thread Boyd, Todd M.
-Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2008 4:34 PM To: Boyd, Todd M. Cc: php-general@lists.php.net Subject: Re: [PHP] Displaying files On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote: -Original Message- From: Stut [mailto

Re: [PHP] Displaying files from database

2007-03-28 Thread Tijnema !
On 3/28/07, Philip Thompson [EMAIL PROTECTED] wrote: Hi. I'm storing an uploaded file into a MySQL database. I want the file to then be downloaded and viewed. Uploading looks like: snippet if (is_uploaded_file($file) $filename) { $handle = fopen ($file, 'r'); $resume[data] = base64_encode

Re: [PHP] Displaying files from database

2007-03-28 Thread Richard Davey
Philip Thompson wrote: Hi. I'm storing an uploaded file into a MySQL database. I want the file to then be downloaded and viewed. Uploading looks like: Assuming you actually have a good reason *why* you are storing uploaded files in your database, how has the table been set-up? What is the

Re: [PHP] Displaying files from database

2007-03-28 Thread Philip Thompson
On Mar 28, 2007, at 12:59 PM, Tijnema ! wrote: On 3/28/07, Philip Thompson [EMAIL PROTECTED] wrote: Hi. I'm storing an uploaded file into a MySQL database. I want the file to then be downloaded and viewed. Uploading looks like: snippet if (is_uploaded_file($file) $filename) { $handle =

Re: [PHP] Displaying files from database

2007-03-28 Thread Philip Thompson
On Mar 28, 2007, at 1:36 PM, Richard Davey wrote: Philip Thompson wrote: Hi. I'm storing an uploaded file into a MySQL database. I want the file to then be downloaded and viewed. Uploading looks like: Assuming you actually have a good reason *why* you are storing uploaded files in your