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?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
furuCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.