version 1.718, 2006/03/05 01:54:50
|
version 1.719, 2006/03/07 02:46:03
|
Line 1320 sub clean_filename {
|
Line 1320 sub clean_filename {
|
|
|
# --------------- Take an uploaded file and put it into the userfiles directory |
# --------------- Take an uploaded file and put it into the userfiles directory |
# input: $formname - the contents of the file are in $env{"form.$formname"} |
# input: $formname - the contents of the file are in $env{"form.$formname"} |
# the desired filenam is in $env{"form.$formname"} |
# the desired filenam is in $env{"form.$formname.filename"} |
# $coursedoc - if true up to the current course |
# $coursedoc - if true up to the current course |
# if false |
# if false |
# $subdir - directory in userfile to store the file into |
# $subdir - directory in userfile to store the file into |
Line 1331 sub clean_filename {
|
Line 1331 sub clean_filename {
|
|
|
|
|
sub userfileupload { |
sub userfileupload { |
my ($formname,$coursedoc,$subdir,$parser,$allfiles,$codebase)=@_; |
my ($formname,$coursedoc,$subdir,$parser,$allfiles,$codebase,$destuname,$destudom)=@_; |
if (!defined($subdir)) { $subdir='unknown'; } |
if (!defined($subdir)) { $subdir='unknown'; } |
my $fname=$env{'form.'.$formname.'.filename'}; |
my $fname=$env{'form.'.$formname.'.filename'}; |
$fname=&clean_filename($fname); |
$fname=&clean_filename($fname); |
Line 1354 sub userfileupload {
|
Line 1354 sub userfileupload {
|
close($fh); |
close($fh); |
return $fullpath.'/'.$fname; |
return $fullpath.'/'.$fname; |
} |
} |
|
|
# Create the directory if not present |
# Create the directory if not present |
$fname="$subdir/$fname"; |
$fname="$subdir/$fname"; |
if ($coursedoc) { |
if ($coursedoc) { |
Line 1369 sub userfileupload {
|
Line 1370 sub userfileupload {
|
$fname,$formname,$parser, |
$fname,$formname,$parser, |
$allfiles,$codebase); |
$allfiles,$codebase); |
} |
} |
|
} elsif (defined($destuname)) { |
|
my $docuname=$destuname; |
|
my $docudom=$destudom; |
|
return &finishuserfileupload($docuname,$docudom,$formname, |
|
$fname,$parser,$allfiles,$codebase); |
|
|
} else { |
} else { |
my $docuname=$env{'user.name'}; |
my $docuname=$env{'user.name'}; |
my $docudom=$env{'user.domain'}; |
my $docudom=$env{'user.domain'}; |