display image in the web by perl

I want to make a web page that other people can post image in my web page,
how can I do it with perl cgi?
mwhuenAsked:
Who is Participating?
 
furuConnect With a Mentor Commented:
RFC 1867 is the standard for file upload via HTTP. You can find documentation on any RFC-site. But honestly, look at cgi.pm first, it will explain all you need. Looking at the RFC's are not for everyone.

How long have you gotten since the last request?
0
 
furuCommented:
Use cgi.pm for this. Take a look at your local CPAN for documentation or try manpages if you're on Un*x or sisters...

What you do is use RFC 1867 to upload file via a webpage. You then store them somewhere on your server.

Try solving this yourself and if your getting trouble, ask again. It is a very complex answer, requiring more info before someone can give you a simple answer.
0
 
mwhuenAuthor Commented:

what is RFC 1867, any documentation in the web of it?
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mwhuenAuthor Commented:
i have looked at CGI.pm for some time,
now looking at RFC 1867, do you know any example sites of uploading images?
0
 
mwhuenAuthor Commented:
i have looked at CGI.pm for some time,
now looking at RFC 1867, do you know any example sites of uploading images?
0
 
mwhuenAuthor Commented:
do you know where have simple cgi.pm tutorials and examples?
thank you.
0
 
furuCommented:
Did you look at the documentation for cgi.pm? There are very simple and ready to use examples for all you need in the docs.

I'm sorry if I seem a bit rude, but it doesn't seem like you are interested in doing much yourself. The information you have gotten so far should be plenty enough to get you going.
0
 
mwhuenAuthor Commented:
I am studying cgi.pm and RFC 1867 now, and finding simple and ready to use examples, I need more examples!!!
Thank you.
0
 
TYoungCommented:
Take a look at this example. It is as simple as can be, but works fine.

http://www.perlservices.com/scripts/uploadhelper/psupload.cgitxt
0
 
mwhuenAuthor Commented:
After I uploaded my image, it always show the previous imge, how can I add <meta http-equiv="Pragma" content="No-cache"> in cgi.pm?

       print header('image/gif');
       open(IMG, ">$num");
       `chmod 666 $num`;
       while(read($file_name,$data,1024)){ print $data;
                                                print IMG $data; }
close(IMG);


In above code, i will only display an image, I would like to add some text in it, how can I add text? with the header is image/gif.

I would like to save the image to my directory, but I always need to chmod,  why?  is my code safe in security?



 
0
 
TYoungCommented:
To expire the image, add the header:

"Expires: now\n"

You will be displaying an image only if you use Content-type: image/gif.

If you use text/html, you can use html. Just get rid of the "print $data;" and in the html that you output, link an <img src to that file.
0
 
mwhuenAuthor Commented:
When I am using function-oriented style, I fill lack of functions such as save parameters, restore parameters, where can I find a list of all the functions of cgi.pm?

can I use function-oriented style and object-oriented style at the same time?
 
0
 
mwhuenAuthor Commented:
where is perldoc CGI?

I have suceeded in uploading files, and save to my directory, and display the contents.

but any security problem I should beware? and any LEGAL problem if I saved and posted every file/image uploaded? (as i can't control what do others upload, one may upload pronographic images)

Thanks very much, guys.
0
 
TYoungCommented:
perldoc is a program on a UN*X Server.

If you have access to a server using a shell account, then you can use it.

Glad you got things working!
0
All Courses

From novice to tech pro — start learning today.