Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # This code is public domain
- #Insert to /usr/lib/cgi-bin/ nazev sample.cgi
- #sudo a2enmod cgi
- #sudo service apache2 restart
- #url je potom http://ip/cgi-bin/sample.cgi
- # grab the current time
- my @now = localtime();
- # rearrange the following to suit your stamping needs.
- # it currently generates YYYYMMDDhhmmss
- my $timeStamp = sprintf("%04d%02d%02d%02d%02d",
- $now[5]+1900, $now[4]+1, $now[3],
- $now[2], $now[1],);
- # insert stamp into constant portion of file name.
- # the constant portion of the name could be included
- # in the sprintf() above.
- select STDOUT; $| = 1; $direction='Test'; if ($ENV{'QUERY_STRING'} eq
- "direction=front") {
- $direction='front';
- } elsif ($ENV{'QUERY_STRING'} eq "direction=back") {
- $direction='back';
- } elsif ($ENV{'QUERY_STRING'} eq "direction=main") {
- $direction='main';
- }
- if ($ENV{'CONTENT_LENGTH'} > 8*1024*1024) {
- exit;
- }
- read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); open
- (H,">/mnt/DataDisk/Camera/camera-".$timeStamp.".jpg"); print H "$buffer"; close H; print
- "Content-type: text/plain\r\n\r\n{\"success\":1}";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement