lilalo

view l3-upload @ 157:137cf5a580be

bsd fix
author Igor Chubin <igor@chub.in>
date Mon Nov 28 13:26:46 2011 +0200 (2011-11-28)
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