version 1.8, 2001/11/29 21:51:40
|
version 1.9, 2001/12/04 18:13:06
|
Line 90 sub phaseone {
|
Line 90 sub phaseone {
|
'<input type=text size=50 name=filename value="/priv/'. |
'<input type=text size=50 name=filename value="/priv/'. |
$uname.'/'.$fn.'"><br>'. |
$uname.'/'.$fn.'"><br>'. |
'<input type=submit value="Store"></form>'); |
'<input type=submit value="Store"></form>'); |
# Check for bad extension |
# Check for bad extension and warn user |
if ($fn=~/\.(\w+)$/ && |
if ($fn=~/\.(\w+)$/ && |
(&Apache::lonnet::fileembstyle($1) eq 'hdn')) { |
(&Apache::lonnet::fileembstyle($1) eq 'hdn')) { |
$r->print( |
$r->print( |
Line 99 sub phaseone {
|
Line 99 sub phaseone {
|
'", is reserved internally by LON-CAPA. <br \>'. |
'", is reserved internally by LON-CAPA. <br \>'. |
'Please change the extension.'. |
'Please change the extension.'. |
'</font>'); |
'</font>'); |
} |
} elsif($fn=~/\.(\w+)$/ && |
|
!defined(&Apache::lonnet::fileembstyle($1))) { |
|
$r->print( |
|
'<font color=red>'. |
|
'The extension on this file, "'.$1. |
|
'", is not recognized by LON-CAPA. <br \>'. |
|
'Please change the extension.'. |
|
'</font>'); |
|
} |
} else { |
} else { |
$r->print('<font color=red>Illegal filename.</font>'); |
$r->print('<font color=red>Illegal filename.</font>'); |
} |
} |
Line 127 sub phasetwo {
|
Line 135 sub phasetwo {
|
} else { |
} else { |
my $source=$r->dir_config('lonDaemons'). |
my $source=$r->dir_config('lonDaemons'). |
'/tmp/'.$datatoken.'.tmp'; |
'/tmp/'.$datatoken.'.tmp'; |
# Check for bad extension |
# Check for bad extension and disallow upload |
if ($fn=~/\.(\w+)$/ && |
if ($fn=~/\.(\w+)$/ && |
(&Apache::lonnet::fileembstyle($1) eq 'hdn')) { |
(&Apache::lonnet::fileembstyle($1) eq 'hdn')) { |
$r->print( |
$r->print( |
Line 135 sub phasetwo {
|
Line 143 sub phasetwo {
|
'<font color=red>'. |
'<font color=red>'. |
'The extension on this file is reserved internally by LON-CAPA.'. |
'The extension on this file is reserved internally by LON-CAPA.'. |
'</font>'); |
'</font>'); |
|
} elsif ($fn=~/\.(\w+)$/ && |
|
!defined(&Apache::lonnet::fileembstyle($1))) { |
|
$r->print( |
|
'File <tt>'.$fn.'</tt> could not be copied.<br />'. |
|
'<font color=red>'. |
|
'The extension on this file is not recognized by LON-CAPA.'. |
|
'</font>'); |
} elsif (copy($source,$target)) { |
} elsif (copy($source,$target)) { |
$r->print('File copied.'); |
$r->print('File copied.'); |
$r->print('<p><font size=+2><a href="'.$fn. |
$r->print('<p><font size=+2><a href="'.$fn. |