rustycanuck Posted May 8, 2006 Share Posted May 8, 2006 Hello all,I'm fairly new to PHP (hence, the post in Newbie Help), and I'm stuck on how to accomplish a particular redirect.I'm trying to view a PDF file, based on an entry by a user. The PHP file is on a local intranet, and the file is located on a networked drive.The user enters an Item # and then a PDF file containing the Vendor information for that Item is displayed.The files are in location: \\serv_1\vendors\ven_info\The files are all named like [Item #]_vend.pdf (ie. 123456_vend.pdf).The code I've written is as follows:$item_num = $_POST['item_num'];if (is_numeric($item_num) && strlen($item_num) == 6) { $default_filepath = "\\serv_1\vendors\ven_info\"; $default_ext = "_vend.pdf"; $filename = $default_filepath . $item_num . $default_ext; if (file_exists($filename)) { header("Location: " . $filename); exit; } else { $msg = "No Vendor Info can be found for Item # " . $item_num; }}else { $msg = "Item Number must be 6-digit number.";}When I try to run the code, the file_exists function works (ie. it can tell if the file exists or not). But when I try to redirect to the PDF file, I get an error saying "Cannot find server".Is there any way I can get the PDF file to open using a header function, or do I need to use something else? Is the problem caused by the location I'm trying to redirect to? Maybe I can't user \\servername\folder format?Any help is appreciated.Thanks,Jay Quote Link to comment Share on other sites More sharing options...
trq Posted May 8, 2006 Share Posted May 8, 2006 You need to give them an address relative to your server. You cant simply redirect to a directory where there is no server running. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.