--- loncom/lonnet/perl/lonuploadrep.pm 2004/03/31 16:12:08 1.1 +++ loncom/lonnet/perl/lonuploadrep.pm 2006/08/21 15:21:31 1.8 @@ -28,12 +28,16 @@ package Apache::lonuploadrep; use strict; use Apache::Constants qw(:common :http); -use Apache::lonnet(); +use Apache::lonrep(); +use Apache::lonnet; use CGI::Cookie(); sub handler { my $r = shift; if ($r->uri =~m|^/*uploaded/(\w+)/(\w+)/(.+)$|) { + my $chome=&Apache::lonnet::homeserver($2,$1); + my @ids=&Apache::lonnet::current_machine_ids(); + foreach my $id (@ids) { if ($id eq $chome) { return OK; } } my $filename = $Apache::lonnet::perlvar{'lonDocRoot'}.'/userfiles/'.$1.'/'.$2.'/'.$3; my ($info, $rtncode); if (-f $filename) { @@ -43,14 +47,14 @@ sub handler { } elsif ( ($info > 0) && ($info =~ /\d+/) ) { my @statinfo = stat($filename); if ($statinfo[9] >= $info ) { - $r->filename($filename); + &Apache::lonrep::update_filename($r,$filename); return OK; } } } - my $response=&Apache::lonnet::getfile($r->uri,'uploadrep'); + my $response=&Apache::lonnet::repcopy_userfile($r->uri); if ($response eq 'ok') { - $r->filename($filename); + &Apache::lonrep::update_filename($r,$filename); return OK; } }