You can do it both ways.

If you choose to retain the original names you will have to create
your own "download" action.

def mydownload(): return
response.stream(open(os.path.join(request.folder,'upload','/'.join(request.args)),'rb'))

You lose the ability to enforce granular access control.

I would follow Lukasz' advice and do from a web2py script

import glob
for filename in glob.glob('/path/to/files/*'):
 
db.yourtable.insert(yourfield=db.yourtable.yourfield.store(open(filename,'rb')))

On Feb 19, 1:14 am, Rowdy <[email protected]> wrote:
> Greetings,
>
> I am migrating a legacy application to web2py.
>
> Part of the legacy data is a large (> 50,000) collection of attachments
> - files of all different types, that were uploaded in various ways to
> the legacy application (typically as email attachments) and need to
> appear in the new web2py application.
>
> I can copy the physical files into the uploads directory of the web2py
> application, and I can insert appropriate rows into the "attachment"
> table in the database.
>
> Are there any special considerations that need to be addressed?
>
> The biggest question is: do the filenames *have* to comply with the
> filenames generated by web2py's upload functionality
> (table.field.uuid.b16encode.ext), or can I keep the existing filenames
> (e.g. image1.jpg, readme.txt, problem.bmp, sample.csv)?
>
> If I must conform to web2py's naming convention, what is the easiest way
> of constructing the uuid part of the filename (I have a separate data
> migration script written in Python that already migrates most of the
> other legacy data)?
>
> Thanx
>
> Rowdy

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to