[EP-tech] Re: create_eprint.pl

Sebastien Francois sf2 at ecs.soton.ac.uk
Wed May 2 15:41:47 BST 2012


Hello,

This is the documentation for add_file:

$doc->add_file( $file, $filename, [$preserve_path] )

$file is the full path to a file to be added to the document, with
name $filename.

So try with the file's full path rather than a file handle?

Seb.


On 02/05/12 15:23, Ulf Laube wrote:
> Hi all,
>
> I try to add a doc onto an eprint like described in the create_eprint.pl
> example:
>
>         $doc_file_name = basename( $file_pdf );
>         open $FILEHANDLER, '<', $file_pdf or die "$!";
>         $doc = EPrints::DataObj::Document::create( $session, $eprint );
>         $doc->set_value( "format", "application/pdf" );
>
>         # line 856: DEPRECATED - use L</add_file>...
>         #$doc->upload( $FILEHANDLER, $doc_file_name );
>
>         $doc->add_file( $FILEHANDLER, $doc_file_name );
>
>         close $FILEHANDLER;
>         $doc->set_value( "main", $doc_file_name );
>         $doc->commit;
>
> But never a file will uploaded:
>
> [img] 	PDF
> paper.pdf
> Download (0b)
>
> What's wrong on my example?
>
> Thanks and best regards
> Ulf



More information about the Eprints-tech mailing list