whatwhatwhat whatwhatwhat - 1 year ago 74
HTML Question

Simple website won't open image on desktop using __DIR__

<!DOCTYPE html>
<title>This is Hello World page</title>

<h1>Hello World</h1>
<img src= "<?php echo __DIR__ .'/pic.png' ?>">

I can't figure out why the code isn't showing the image. I made sure to name the file with a
extension and to put both files in the same folder (the desktop).

The eventual goal is to upload an entire folder to a server. Within that folder, there will be an
file and an image. How can I point the file to the image?

Answer Source

If pic.png is in the same directory, this will work.

<img src="pic.png">

Also, move the img tag into the body.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download