Image could not be loaded using CGI program
I am writing to write a cgi script to display a png image in a browser. When user clicks on the 'Submit' form in the HTML page , the CGI program is called to display the image .
But this is not working for me . When the script is executed , the text in alt section from img src HTML tag is displayed , rather than the image The following is the snippet of CGI code. !/bin/bash echo "Content-type: text/html" echo "" echo "<html>" echo "<body>" echo "Hi" echo "<img src="/home/zaman/graph/SSDGhistory.png" alt="DG-Reports">" echo "</body>" echo "</html>" If I write the same code in plain HTML page , the PNG image is displayed fine. Please suggest what I am missing in the code to display the image without any errors ? |
Try View/Source in your browser to see what your script has done.
|
Shouldn't that be:
Code:
file:///home/zaman/graph/SSDGhistory.png Quote:
|
For example, this line needs to be fixed:
Code:
echo "<img src="/home/zaman/graph/SSDGhistory.png" alt="DG-Reports">" |
the folder would be relative to what is set as "documentroot"
or be accessible from the net with a ip address |
Quote:
|
All times are GMT -5. The time now is 02:53 PM. |