views:

82

answers:

1

I need a blob file field as part of a content type in plone. plone.app.blob's BlobField should provide this, but I can't find how to get a URL to download the file including the original filename (e.g. http://plone.site/plone/obj/orig-file-name.avi). Is there a way to do this using plone.app.blob?

Alternately, there are a few pointers on the web pointing to plone.namedfile to do this. plone.namedfile seems to rely on z3c.blobfile. How does z3c.blobfile differ from plone.app.blob?

Is one of these methods better than the other?

vik

A: 

If you want to download the file using the original filename, you'll need a few more pieces:

  1. Make sure you put primary=True in the field's settings in the schema.

  2. Make sure your content type's class subclasses plone.app.blob.content.ATBlob, which provides an index_html method that downloads the primary field.

  3. Make sure you add your content type's portal_type to the typesUseViewActionInListings list in portal_properties/site_properties.

plone.namedfile provides a file field that can be used with the z3c.form library. It is indeed based on z3c.blobfile, which provides a similar interface to the file object from zope.app.file. This is probably not what you want if you're building an Archetypes-based content type.

David Glick