Tech List

[index] [prev] [next] [options] [help]
See the Mailing Lists Page for how to subscribe and unsubscribe.

eprints_tech messages

Please note: this page shows emails that have been sent to the eprints_tech mailing list. Some of these may be spam emails we have failed to filter.

Re: [EP-tech] upload() does not take absolute paths

From: Tim Brody <tdb01r AT ecs.soton.ac.uk>
Date: Tue, 06 May 2008 15:40:56 +0100


Threading: [EP-tech] upload() does not take absolute paths from roman.chyla AT gmail.com
      • This Message

*** http://www.eprints.org/tech.php/id/%3C48206DF8.6000501%40ecs.soton.ac.uk%3E
*** EPrints community wiki - http://wiki.eprints.org/

Roman Chyla wrote:
> *** 
http://www.eprints.org/tech.php/id/%3Cea0115e90805020852g462f09b0q704763a46b9d6862%40mail.gmail.com%3E
> *** EPrints community wiki - http://wiki.eprints.org/
>
> Hello all,
>
> I am importing files into Eprints and the method upload() complains
> that the file starts with slash. Am I doing something wrong? Maybe I
> should use something else for automatic data imports?
> Other than?
>
>   while(my ($key, $value) = each(%$fields)) {
>     $eprint->set_value( $key, $value);
>   }
>
> Note, when I do chdir() and pass a filepath with a relative name, than
> EPrints imports happily (so it is no security measure against some web
> attacks). Otherwise, one would expect that absolute paths are OK with
> imports.
>   
Hi Roman,

The filename argument to upload() is just to *name* the file. It is 
expect to be either just the filename (no embedded slashes) or a 
relative path with $preserve_path enabled.

You should strip any leading pathing from the filename as the data is 
read from the filehandle. Alternatively use the add_file() wrapper 
method that takes a directory + filename.

Cheers,
Tim.


[index] [prev] [next] [options] [help]