CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Advanced:
uploading an image



Oct 23, 2001, 6:33 AM

Post #1 of 4 (2247 views)
uploading an image Can't Post

I'm trying to add a browse feature to allow the user to upload an image along with the sumbission form.
In the Perl Script the user is now filling the field and they are automatically going live onto the site. (just like a message board), so How can I add the browse where the image will come along?

Thank you


Oct 25, 2001, 10:40 AM

Post #2 of 4 (2242 views)
Re: uploading an image [In reply to] Can't Post

U can use the CGI module for the uploading task. The module can handle all the difficult parts of it.

At the end, your CGI script (written in perl off course) should store the image somewhere at the webserver.

Most likely you need an other CGI script that dynamically generates a HTML page, where in the image location is stored (like

 print qq[<IMG src="$TheImage">];

in perl code.

If we're just talking about one image at the same location, you can use this HTML tag to get the image:

<IMG src="/path/to/script.cgi">

Administrator / Moderator

Oct 26, 2001, 9:39 AM

Post #3 of 4 (2234 views)
Re: uploading an image [In reply to] Can't Post

Actually, for printing an image, you can also use:

print img( -src => $TheImage );

After all, you're already using the CGI module -- why not use everything in it that's usable? Smile


Oct 28, 2001, 9:08 AM

Post #4 of 4 (2227 views)
Re: uploading an image [In reply to] Can't Post

Sorry I never do that!

I use the CGI module for my CGI handling. I'm better in programming HTML directly using as <<HERE; block.

That means I import the CGI stuff like this:

use CGI qw(:cgi);

Then you only get the functions for getting info (environment and parameters), and printing headers or redirects correctly. I've seen that failing in other CGI scripts nog using the CGI module.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives