Gehrigal - Webminprojects wrote:
> Hi all,
>
> at the moment i am working on a new module for webmin.
> In this module the user should be able to upload files.
> But there is a bug in my perlscripte, and so the uploaded file will be
> allways 0 byte.
>
> .....
> my $q = new CGI;
>
> my $file = $q->param("file") || &error( "No File received!");
> my $file_name = $q->param("file_name") || & error ( "There was no
> Filename!");
> my $fh = $q->upload("file");
> my $buffer = "";
>
>
> my $full_filename="$skin_dir"."/"."$file_name";
>
> open(OUTPUT, ">$full_filename");
> while (read( $fh, $buffer, 512000) ){ print OUTPUT $buffer;}
> close (OUTPUT);
I'm not too familiar with the CGI module, but using webmin's API you could
write :
&ReadParseMime();
my $full_filename="$skin_dir"."/".$in{'file_name'};
open(OUTPUT, ">$full_filename");
print OUTPUT $in{'file'};
close(OUTPUT);
- Jamie
|