[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: Maximum file size for an eprints document upload?



Hi Claire,

 I add this code to EPrints:Plugin::Screen::EPrint::UploadMethod in
method "action_add_format" after row

    /my $filepath = $session->query->tmpFileName( $fh );/

 This is my code:

    /        my $size=-s $filepath;/
    /        if( $session->can_call('upload_file')) {/
    /           my
    @problems=$session->call('upload_file',$session,$size,$filepath,$filename);/
    /           if (@problems) {/
    /             $processor->{notes}->{upload} = {};/
    /             foreach (@problems) {/
    /               $processor->add_message( "error",$_);/
    /             }/
    /             $processor->{notes}->{upload} = {};/
    /             $processor->{notes}->{epdata} = {};/
    /             return 0/
    /           }/
    /        }/

Then in cfg/cfg.d you can add a configuration file like "upload.pl" with
this content:

    $c->{'upload'}={
      upload_limit=>100*1024*1024,
    };
    $c->{'upload_file'}=sub {
      my ($session,$size,$filepath,$filename)=@_;
      my @problems=();
      my $upload_limit=$session->get_repository->get_conf('upload');
      $upload_limit=$upload_limit->{'upload_limit'};
      if ( $upload_limit &&  $size > $upload_limit ) {
         push @problems,$session->html_phrase(
    "Plugin/InputForm/Component/Upload:upload_failed",cause=>$session->make_text("file
    size $size bytes > $upload_limit bytes") )
      }


You can change your limit by upload_limit in upload.pl (in the example
the limit is 100MB)
So in upload.pl we can insert code for antivirus check also.

Regards,
  Enio


Il 05/04/2012 13:40, C.Eskriett at brighton.ac.uk ha scritto:
>
> Hi
>
>  
>
> I've been trying to find out (in response to a question from the
> people implementing our new CRIS)if eprints has a maximum file size
> for document upload. My googling has let me down on this. I can't see
> where this might be configurable within cfg.d files, but maybe it is
> elsewhere on the server? Can anyone enlighten me on where to look? I
> imagine we either have the default value or no value, but need to
> confirm what that defulat value might be.
>
>  
>
> Here's hoping!
>
> Many thanks
>
>  
>
> Claire
>
>  
>
> *Claire Eskriett, Systems Librarian*
>
> *(Days of work are Mon, Tues, Thurs & Fri)*
>
> Information Services
>
> Cockcroft Building
>
> University of Brighton
>
> Lewes Road
>
> Brighton BN2 4GJ
>
> T: 01273 642766
>
> E: C.Eskriett at brighton.ac.uk
>
>  
>
>  
>
>
> ___________________________________________________________
> This email has been scanned by MessageLabs' Email Security
> System on behalf of the University of Brighton.
> For more information see http://www.brighton.ac.uk/is/spam/
> ___________________________________________________________
>
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/

-- 
____________________________________
 Ing. Enio Carboni
 CESIA - Centro Servizi Informatici di Ateneo 
 Alma Mater Studiorum - Universit? di Bologna
 V.le Filopanti, 3 - 40126 Bologna - Italy
 http://www.unibo.it
 http://www.biblioteche.unibo.it
 mailto:enio.carboni at unibo.it
____________________________________


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20120406/a2d945f5/attachment-0001.html