python - Upload file with framework Zope -
i users of zope/plone website can upload (big) file (>1gb) on server.
i have form in html :
<form enctype="multipart/form-data" action="upload.py" method="post"> <p>file: <input type="file" name="file"></p> <p><input type="submit" value="upload"></p> </form>
i have external script zope : upload.py
def get(self, request): filename = request.file['file']
unfortunately don't know file..
i found tutorial think i'm on wrong way (because these methods can't work zope ?):
cgi : http://webpython.codepoint.net/cgi_file_upload
ftplib : python script uploading files via ftp
thanks advices,
it depends on how , want store it.
the request.file file object can read, seek, tell etc contents from.
you can store blob:
from zodb.blob import blob blob = blob() bfile = blob.open('w') bfile.write(request.file) bfile.close() # save blob somewhere context.myfile = blob
Comments
Post a Comment