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: "Roman Chyla" <roman.chyla AT gmail.com>
Date: Tue, 6 May 2008 19:50:14 +0200


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

*** 
http://www.eprints.org/tech.php/id/%3Cea0115e90805061050t3a3e2f17jf7af26e73439c1d9%40mail.gmail.com%3E
*** EPrints community wiki - http://wiki.eprints.org/

On Tue, May 6, 2008 at 4:40 PM, Tim Brody <tdb01r AT ecs.soton.ac.uk> 
wrote:
> ***
> 
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.

Hi Tim,

Many thanks for the reply. Oddly enough, it worked with the upload().
I have only experienced strange behaviour on one machine for some
files and not the others (with the same script and the same data) but
this can be something else which I need to investigate.

>
>  You should strip any leading pathing from the filename as the data is 
read
I see now, I missed that 'detail' too

> from the filehandle. Alternatively use the add_file() wrapper method that
> takes a directory + filename.

Cheers,

  roman

>
>  Cheers,
>  Tim.
>
>


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