Hytham wrote:
> hi gurus,
> first of all, am really gracefull about all who
> sends me tips of how to
> make this thing work, but, unfortunately, it doesn't
> yet.
I'm not sure if this will help, but here is a snippet from a program I've
been working on that uploads html files from a client to a server:
sub uploadFile {
my $s = shift;
if ($s->{param}{file} ne "") {
my $path;
for ($s->{config}{doc_root}, $s->{config}{article_dir}, $s->{name})
{
die "illegal characters in config file" if
m|[^a-zA-Z0-9_/\.\-]|;
/^(.*)$/;
$path .= $1; # untainting the list above
}
my $file = $q->param("file"); # Must do this param individually.
Not sure why.
open(OUTFILE, ">$path")
or die "unable to open $s->{config}{article_dir}$s->{name}";
while (my $bytesread = read($file, my $buffer, 1024)) {
print OUTFILE $buffer;
}
close(OUTFILE);
} elsif ($s->{param}{type} =~ /cr/i) {
print "Error: no file selected.";
}
}
To see the rest of this file (Soapbox.pm) go here:
http://www.redsquirreldesign.com/soapbox/Soapbox.pm.txt
To see more about the entire program, go here:
http://www.redsquirreldesign.com/soapbox/
HTH
=====
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave