denoteone Posted January 28, 2008 Share Posted January 28, 2008 Can I reference a local server that has images on it with a PHP variable. I created a database that has the paths to all the images on our image server. the variable $path is equal to Ocds1/data1/ and my code looks like this $path = $row['path']; <a href='$path'>Click here for image</a> $path /n but the URL is not pointing to the server. it is pointing to the url of the website it is on Quote Link to comment Share on other sites More sharing options...
mem0ri Posted January 28, 2008 Share Posted January 28, 2008 If you're pointing to a separate server, you'll want to work with an 'absolute' link rather than a 'relative' link. Quote Link to comment Share on other sites More sharing options...
slpctrl Posted January 28, 2008 Share Posted January 28, 2008 I think more details are needed. Post more code or all if possible so I can wrap my head around what you're trying to do. Also, if the link is static, as it appears, why bother making it a variable? Quote Link to comment Share on other sites More sharing options...
MatthewJ Posted January 28, 2008 Share Posted January 28, 2008 Memori is "Absolutely" right Pardon the pun. Quote Link to comment Share on other sites More sharing options...
denoteone Posted January 28, 2008 Author Share Posted January 28, 2008 the links will only be used by people in my office. so we are accessing the application online to find out were a selected image is located on our image server. the path to the server is always going to be "Ocfds1\Data1" and on click i want the browser to go to that location on the server so the user can just click and open the image. my full page of code is <? include "connect.php"; if (isset($_POST['submit'])) // name of submit button { $choice=$_POST['option']; $query = "SELECT * from strata_links WHERE name='$choice' "; $result = mysql_query($query); if (!($result)) { echo "<br><B>ERROR</B>query did not happen result is false"; echo "<BR>query= $query"; echo "<BR>result= $result"; echo "<BR>mysql error no= ".mysql_errno().": ".mysql_error()."<BR>"; }; while ($row = mysql_fetch_assoc($result)) { $path = $row['path']; echo "<a href='$path'>Click here for image</a> $path /n"; $description = $row['description']; echo "$description"; } } else{ print "<center>"; print "<table>"; print "<tr><td><center>please select a File first</center></td></tr>"; print "<tr><td><center>"; print "You have to Selct Image name first..... <META HTTP-EQUIV = 'Refresh' Content = '2; URL =getimage.php'></center>"; print "</td></tr></table></center>"; } ?> Quote Link to comment Share on other sites More sharing options...
MatthewJ Posted January 28, 2008 Share Posted January 28, 2008 That makes perfect sense, but the path will still have to be a useable UNC path. For example, hop on the server and connect to the folder with the images in it. Whatever path you have to use to connect from there, is the path you need to use in code. I would assume something like \\Ocds1\data1\ assuming that the location is a valid network share. 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.