lilalo

view 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
line source
1 #!/usr/bin/perl
2 #
3 BEGIN {
4 chdir("/etc/lilalo/");
5 require l3config;
6 l3config::init_config();
7 };
9 use CGI;
10 $upload_dir = "/var/www/xguru/l3shot";
11 $query = new CGI;
13 $filename = $query->param("photo");
14 $filename =~ s/.*[\/\\](.*)/$1/;
15 $upload_filehandle = $query->upload("photo");
17 my $convert="";
18 if ($filename =~ s/.xwd$/.png/g) {
19 $convert="|xwdtopnm|pnmtopng";
20 }
22 open UPLOADFILE, "$convert>$upload_dir/$filename";
23 binmode UPLOADFILE;
24 while ( <$upload_filehandle> )
25 {
26 print UPLOADFILE;
27 }
29 close UPLOADFILE;
31 print $query->header ( );
32 print <<END_HTML;
33 Upload complete
34 END_HTML