Create a form for upload (you may also use CGI.pm to create the form)
like this:
<form name="upload" action="myperl.pl" enctype="multipart/form-data"
method="post">
<input type="file" name=" ">
<input type="submit" value= "ok">
</form>
myperl.pl
use CGI (:standard);
my $file = param("file_to_upload");
my $destination = "any_name.txt";
# Open a file handle to write the upload file.
Open (FH, ">/path/$destination");
while (<$file>){
print FH -$_;
}
close FH;
You may also use "read or sysread".
See perldoc -f read for details
HTH
Babs
||> -----Original Message-----
||> From: John Pretti [mailto:[EMAIL PROTECTED]
||> Sent: Tuesday, April 20, 2004 3:51 PM
||> To: [EMAIL PROTECTED]
||> Subject: Perl File Uploading
||>
||> All,
||>
||> I am a total n00b to perl and have decided to write my own file
upload
||> script for a task I have to do. It is my intention to use CGI to
accomplish
||> to allow users to upload a file through a webpage. I do not quite
understand
||> the process, and thought it would be similar to the php function
copy, but
||> this appears not to be the case. Can someone point me in the right
direction
||> or help me to understand how this is supposed to work.
||>
||> Thanks in advance.
||>
||> John
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>