Link to home
Start Free TrialLog in
Avatar of mwhuen
mwhuen

asked on

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?
Avatar of furu
furu
Flag of Norway image

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.
Avatar of mwhuen
mwhuen

ASKER


what is RFC 1867, any documentation in the web of it?
ASKER CERTIFIED SOLUTION
Avatar of furu
furu
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mwhuen

ASKER

i have looked at CGI.pm for some time,
now looking at RFC 1867, do you know any example sites of uploading images?
Avatar of mwhuen

ASKER

i have looked at CGI.pm for some time,
now looking at RFC 1867, do you know any example sites of uploading images?
Avatar of mwhuen

ASKER

do you know where have simple cgi.pm tutorials and examples?
thank you.
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.
Avatar of mwhuen

ASKER

I am studying cgi.pm and RFC 1867 now, and finding simple and ready to use examples, I need more examples!!!
Thank you.
Take a look at this example. It is as simple as can be, but works fine.

http://www.perlservices.com/scripts/uploadhelper/psupload.cgitxt
Avatar of mwhuen

ASKER

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?



 
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.
Avatar of mwhuen

ASKER

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?
 
Avatar of ozo
Avatar of mwhuen

ASKER

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.
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!