|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello there,
I can't show images using my cgi scripts in perl and html. Now I have a doubt whether I should do something with the apache server. Should i upload it to apache server. At present I just call the .png or .jpg files in my html code using the html img src..... I am getting only broken image icons in my output. Could anyone please help. Thank you Dups |
|
#2
|
|||
|
|||
|
I'm not entirely sure what your problem is. The image files you want to use should be uploaded to the apache server, unless you are using them off other websites.
Please can you supply the problematic line of code. |
|
#3
|
|||
|
|||
|
Hello there..
Could u please tell about how to upload images to apache server? At present i am not uploading the images. Please help. Thank u Dups |
|
#4
|
|||
|
|||
|
Well, there was a quick tutorial on here entitled beam me up scotty, which tells you how to do it in PHP (assuming you have access to PHP). It basically works like this,
First page is a form: It has the line <INPUT type=file name=image.file.name> The form is then processed by a second script, which has four variables passed to it from the previous webpage. These variables are: temporary file name file type original file size original file name You would need to find out what variables are passed to the cgi script (assuming you want to do this in perl), and can be checked with a small script like this: print "<TR><TH ALIGN=RIGHT>KEY<TD ALIGN=LEFT>Value(s)</TR>"; for $key (sort keys %{$input}) { print "<TR><TD ALIGN=RIGHT>$key<TD ALIGN=LEFT>"; print join ", ",split /\0/, $input->{$key}; print "</TR>"; } This should show you the names of the four variables passed to the script. Then just copy and rename as appropriate. |
|
#5
|
|||
|
|||
|
or failing that...
You should be able to upload images the same way you upload files. |
|
#6
|
|||
|
|||
|
I think this is what you want.
I think you want to use a cgi script to choose which image to show, like on a banner server, and put the script filename into the <IMG> tag, if so then here is some code I had lying around, call this perl file 'chooseimg.pl' or 'chooseimg.cgi':
#!c:\Perl\bin\Perl.exe use strict; use CGI qw(:all); #Put the image full path and filename in next line. my $image="c:/apache/htdocs/ads/468x60/123.jpg"; #Change jpg to gif or png if needed. print header(-type => 'image/jpg'); open(IMAGE, "$image") || exit; binmode STDOUT; binmode IMAGE; print <IMAGE>; close(IMAGE); exit; Then you need to put this into your html page: <IMG SRC="chooseimg.pl"><!--or chooseimg.cgi--> Hope that is what you wanted. [Edited by Paul H on 03-17-2001 at 03:57 PM] |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > uploading images to apache server |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|