lilalo

annotate l3-upload @ 158:d775ffd49dbf

minifix: bsd/darwin in uname
author Igor Chubin <igor@chub.in>
date Wed Feb 01 17:14:54 2012 +0200 (2012-02-01)
parents 58c869722fd0
children
rev   line source
igor@113 1 #!/usr/bin/perl
igor@113 2 #
igor@128 3 BEGIN {
igor@128 4 chdir("/etc/lilalo/");
igor@128 5 require l3config;
igor@128 6 l3config::init_config();
igor@128 7 };
igor@113 8
igor@113 9 use CGI;
igor@121 10 $upload_dir = "/var/www/xguru/l3shot";
igor@113 11 $query = new CGI;
igor@113 12
igor@113 13 $filename = $query->param("photo");
igor@113 14 $filename =~ s/.*[\/\\](.*)/$1/;
igor@113 15 $upload_filehandle = $query->upload("photo");
igor@113 16
igor@113 17 my $convert="";
igor@113 18 if ($filename =~ s/.xwd$/.png/g) {
igor@113 19 $convert="|xwdtopnm|pnmtopng";
igor@113 20 }
igor@113 21
igor@113 22 open UPLOADFILE, "$convert>$upload_dir/$filename";
igor@113 23 binmode UPLOADFILE;
igor@113 24 while ( <$upload_filehandle> )
igor@113 25 {
igor@113 26 print UPLOADFILE;
igor@113 27 }
igor@113 28
igor@113 29 close UPLOADFILE;
igor@113 30
igor@113 31 print $query->header ( );
igor@113 32 print <<END_HTML;
igor@113 33 Upload complete
igor@113 34 END_HTML
igor@113 35
igor@113 36