Valhalla Legends Forums Archive | Web Development | [Perl] File uploads

AuthorMessageTime
Undeference
Okay, it's official: I can't find how to handle file uploads. I used to be able to do this, mind you, but it is only more recently that I've forgotten.
I can't even find any information on files being passed to CGIs. I know how the file is sent, I just don't know what the server does with it.

Any help please?
August 31, 2004, 8:28 PM
St0rm.iD
are you using a library or doing it yourself?

EDIT: google found me this: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=348&lngWId=6
August 31, 2004, 8:57 PM
Undeference
Okay... at any rate... here's how you can go about doing this (FYI, I was being stupid...):

enctype="multipart/form-data"

[list]
[*][code]
my ($postdata) = '';
while (read (STDIN, $postdata, 1, length ($postdata)) != 0) { print $!; }
[/code]
or[*][code]
my ($postdata) = '';
while (!eof (STDIN)) { read (STDIN, $postdata, 1, length ($postdata)); }
[/code]
or[*][code]
sub post {
my ($res, $result) = (' ', '');
while ($res ne '') { $result .= &readdata; }
}
sub readdata {
read (STDIN, $r, 1) or die "Couldn't read standard input: $!";
return $r;
}
[/code]
or[*][code]
my (@lines) = <STDIN>;
[/code][/list]
September 1, 2004, 12:00 AM

Search