Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image does not display with perl cgi

Status
Not open for further replies.

Gazmend

Instructor
Apr 2, 2007
6
Please Help me with my first script in Perl CGI: I have this cgi-perl code:
#!C:\Perl\bin\perl.exe
# hello.pl -- my first perl script!
print "Content-type: text/html\n\n";
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Hello, world1!</TITLE>
</HEAD>
<BODY>
<p>
<img src="a.gif">
</BODY>
</HTML>
EOF

and it works, but the image does not come up. I tried to change the image' s location, but it didn't work again.
 
you need the correct URL of the image, either the full URL:

<img src="
or a relative URL:

<img src="../folder/frog.jpg">

Don't put the image in the cgi-bin folder, that folder is normally setup to block access to all files except scripts.



------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
I tried that, but it didn't work
 
it did not work" is too vague of a response.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
What directory is your script in? What directory is your image in?
 
the script is in the /cgi-bin directory; for the image - I tried to put it in the /icons directory, then in a special folder in the Apache directory, in C:, in Desktop, in the/cgi-bin direcory .... but the image doesn't display
 
OK well the first thing is to make sure you can view your image in the boring through-the-browser way, without worrying about your Perl code at all. Put it in the "icons" directory and see if you can view it by typing " into the address bar of your browser (replacing "localhost" with whatever's relevant if necessary). If that works, then that's the URL you need to put in your Perl script.
 
I tried, and I got "The requested URL /icons/a.gif was not found on this server". And the image "a.gif" is int the C:\Program Files\Apache Software Foundation\Apache2.2\icons folder
 
I'm not sure about apache2.2, earlier versions of apache have an htdocs folder, which is where your web accessible files should be.

------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top