Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Cgi pm and photo uploads

by chanio (Priest)
on Oct 04, 2003 at 20:41 UTC ( [id://296580]=note: print w/replies, xml ) Need Help??


in reply to Cgi pm and photo uploads

Sorry if I haven't understood you well.

Let me explain you the concept of what I think that you have said:

to upload something from any PC to a server there is a lot of magic!

Basicaly, you need someone asking for a file from the server.

And another one, pushing a file from the user's PC.

To do this, you need more than an HTML form.

That is just speaking. But you must also do something to make it happen.

That is where perl comes as an agent from the server part.

You don't need to have perl in the users part. Just the HTML form would do that part by fetching the file.

After submiting the form, you need perl to handle the data being transfered. It has to read that data and write the file's content to the directory that you chose.

# open a new file and transfer bit by bit from what's in the buffer open( SAVED, ">>$localfile" ); # || die $!; while ( $bytesread = read( $remotefile, $buffer, 1024 ) ) { print SAVED $buffer; } close SAVED;
So your form called the perl script that you wrote and left at the server's /cgi-bin/ directory.

That script read all the ulpoaded file and wrote it bit by bit on the directory that you chose.

Now you need to finish the script and show the image in some new html page.

To get your script be more than words written in a file, you need to have perl installed at the same location that you declared at the first line of your cgi script.

You could know that it is correct if you see that perl is in the folder /usr/bin/ . If not, you could change that starting text with the name of the directory where Perl resides...

At the command promp you should write:where perl And what you read as an answer is what you should copy at line 1

You should read a complete book and try some examples until you get all the idea: http://sunsite.iisc.ernet.in/virlib/perl/example/ewtoc.html .

Replies are listed 'Best First'.
Re: Re: Cgi pm and photo uploads
by liz (Monsignor) on Oct 04, 2003 at 21:42 UTC
    ...At the command promp you should write:where perl And what you read as an answer is what you should copy at line 1...

    FWIW, on my non-Win machines, this has always been which perl rather than where perl.

    From the man page:

    which takes a list of names and looks for the files which would be executed had these names been given as commands. Each argument is expanded if it is aliased, and searched for along the user's path.

    Liz

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://296580]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found