Hi,

I have a problem. I created multiple files upload like this:
            if "attachments" in request.vars:
                attachments = request.vars.attachments
                if type(attachments) is list:
                    for attachment in attachments:
                        Attachment.save(attachment.file, attachment.filename
, request.args(0))
                else:
                    Attachment.save(attachments.file, 
attachments.filename,request
.args(0))

                return Redirect.to(request.env.http_referer)

save method:
    def save(file, filename, entry_id):
        image = db.entry.entry_label.store(file, filename)
        attachment_dict = dict()
        attachment_dict["entry_id"] = bson.ObjectId(oid=str(entry_id))
        attachment_dict["file"] = image
        attachment_dict["filename"] = filename
        mongo.attachment.save(attachment_dict)

First of all i would like to avoid using DAL when saving images. 
image = db.entry.entry_label.store(file, filename)
Does web2py have any mechanism for uploading? I would be great to have a 
class that handles uploads For my point of view framework needs to be set 
of tools for the developer, although storing images this way could be nice 
in some case, i think upload and download must not be connected to DAL. I 
want to store my image on the filesystem, i don't see what that has to do 
with DAL.

I have download function:
def nt_download():
    return response.stream(open(os.path.join(request.folder, 'uploads',request
.args(0))), attachment=True)
This code doesn't work properly for files like pdf, xls. How i can fix this?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to