igor@113: #!/usr/bin/perl igor@113: # igor@128: BEGIN { igor@128: chdir("/etc/lilalo/"); igor@128: require l3config; igor@128: l3config::init_config(); igor@128: }; igor@113: igor@113: use CGI; igor@121: $upload_dir = "/var/www/xguru/l3shot"; igor@113: $query = new CGI; igor@113: igor@113: $filename = $query->param("photo"); igor@113: $filename =~ s/.*[\/\\](.*)/$1/; igor@113: $upload_filehandle = $query->upload("photo"); igor@113: igor@113: my $convert=""; igor@113: if ($filename =~ s/.xwd$/.png/g) { igor@113: $convert="|xwdtopnm|pnmtopng"; igor@113: } igor@113: igor@113: open UPLOADFILE, "$convert>$upload_dir/$filename"; igor@113: binmode UPLOADFILE; igor@113: while ( <$upload_filehandle> ) igor@113: { igor@113: print UPLOADFILE; igor@113: } igor@113: igor@113: close UPLOADFILE; igor@113: igor@113: print $query->header ( ); igor@113: print <<END_HTML; igor@113: Upload complete igor@113: END_HTML igor@113: igor@113: