Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 9th, 2001, 12:52 AM
Dups Dups is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 30 Dups User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
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

Reply With Quote
  #2  
Old March 12th, 2001, 06:42 AM
Wildheart Wildheart is offline
Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Manchester, England
Posts: 5 Wildheart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #3  
Old March 13th, 2001, 10:58 PM
Dups Dups is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 30 Dups User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Unhappy

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

Reply With Quote
  #4  
Old March 14th, 2001, 04:06 AM
Wildheart Wildheart is offline
Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Manchester, England
Posts: 5 Wildheart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.


Reply With Quote
  #5  
Old March 14th, 2001, 04:25 AM
Wildheart Wildheart is offline
Coder
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Manchester, England
Posts: 5 Wildheart User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
or failing that...

You should be able to upload images the same way you upload files.

Reply With Quote
  #6  
Old March 17th, 2001, 04:55 PM
Paul H Paul H is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Posts: 4 Paul H User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > uploading images to apache server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT