[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Thu, 22 Jul 2004 22:12:09 -0000
raeburn Thu Jul 22 18:12:09 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Used to handle file uploaded to help request form. For 1.2
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.522 loncom/lonnet/perl/lonnet.pm:1.523
--- loncom/lonnet/perl/lonnet.pm:1.522 Fri Jul 16 13:56:01 2004
+++ loncom/lonnet/perl/lonnet.pm Thu Jul 22 18:12:06 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.522 2004/07/16 17:56:01 albertel Exp $
+# $Id: lonnet.pm,v 1.523 2004/07/22 22:12:06 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1282,6 +1282,22 @@
# See if there is anything left
unless ($fname) { return 'error: no uploaded file'; }
chop($ENV{'form.'.$formname});
+ if (($formname eq 'screenshot') && ($subdir eq 'helprequests')) { #files uploaded to help request form are handled differently
+ my $now = time;
+ my $filepath = 'tmp/helprequests/'.$now;
+ my @parts=split(/\//,$filepath);
+ my $fullpath = $perlvar{'lonDaemons'};
+ for (my $i=0;$i<@parts;$i++) {
+ $fullpath .= '/'.$parts[$i];
+ if ((-e $fullpath)!=1) {
+ mkdir($fullpath,0777);
+ }
+ }
+ open(my $fh,'>'.$fullpath.'/'.$fname);
+ print $fh $ENV{'form.'.$formname};
+ close($fh);
+ return $fullpath.'/'.$fname;
+ }
# Create the directory if not present
my $docuname='';
my $docudom='';