lilalo

annotate l3-upload @ 123:b1685388f821

apt-get install deps disabled
author Igor Chubin <igor@chub.in>
date Fri Jul 04 10:46:41 2008 +0300 (2008-07-04)
parents 9e6359b7ad55
children 56cd2abd3e8a
rev   line source
igor@113 1 #!/usr/bin/perl
igor@113 2 #
igor@113 3
igor@113 4 use CGI;
igor@121 5 $upload_dir = "/var/www/xguru/l3shot";
igor@113 6 $query = new CGI;
igor@113 7
igor@113 8 $filename = $query->param("photo");
igor@113 9 $filename =~ s/.*[\/\\](.*)/$1/;
igor@113 10 $upload_filehandle = $query->upload("photo");
igor@113 11
igor@113 12 my $convert="";
igor@113 13 if ($filename =~ s/.xwd$/.png/g) {
igor@113 14 $convert="|xwdtopnm|pnmtopng";
igor@113 15 }
igor@113 16
igor@113 17 open UPLOADFILE, "$convert>$upload_dir/$filename";
igor@113 18 binmode UPLOADFILE;
igor@113 19 while ( <$upload_filehandle> )
igor@113 20 {
igor@113 21 print UPLOADFILE;
igor@113 22 }
igor@113 23
igor@113 24 close UPLOADFILE;
igor@113 25
igor@113 26 print $query->header ( );
igor@113 27 print <<END_HTML;
igor@113 28 Upload complete
igor@113 29 END_HTML
igor@113 30
igor@113 31