Jump to content

Whats wrong with this code


Recommended Posts

Hi there,

 

I am developing a content management system, and I have some details stored in a mysql database. I am trying to retrieve an image whose path is stored in the database.

 

I obtained the path using the following:

 

$uploadDir = $_SERVER['DOCUMENT_ROOT'] .  "/images/portfolio/";

 

and after retrieving the details from the database, I am trying to display it using the below as part of a table:

 

echo "<td rowspan=\"3\"><img src=\" ".$content . "\"/></td>";

 

but the image is not showing. I would appreciate it if someone could point me in the right direction as I have been staring at this for the past 30 minutes without a clue.. :(

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/103812-whats-wrong-with-this-code/
Share on other sites

I don't think you want to use DOCUMENT_ROOT. That will return the local path. I assume you want the path to the images to be accessible to people on the Internet, which this won't be.

 

Do you want the result to be http://mysite.com/images or c:\inetpub\wwwroot\images (windows) or /www/mysite/images (unix)?

 

There's a way to get the path, but I can't think of it right now.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.