You are here: Home / Documentation / How To's / How to allow batch file uploads on your site

How to allow batch file uploads on your site

by nguyen — published Aug 24, 2009 03:35 PM, last modified Aug 16, 2016 10:50 AM
so that you don't have to keep doing "Add new" -> "File", etc.

There are a few ways you can allow users to upload files more easily than via the usual Plone "Add New" -> "File" menu, that requires several clicks and filling out of text fields.

WebDAV

Plone supports WebDAV out of the box, though that was somewhat broken up until Plone 3.3 if you happened to use Squid as a cacheing proxy.  (Sorry about the geek terminology).  As of Plone 3.3 which was released only days ago, WebDAV should be available and working again.

PloneFlashUpload

The PloneFlashUpload product has been the mainstay of anyone who didn't have WebDAV working.  However PFU has the distinct problem of being very Flash version aware.  If your users have too old or too new a version of the Flash plugin installed in their browser, PFU will not work.  Generally I have a dislike of Flash anyhow so if I can avoid requiring my users to have it and to use it, all the better.  I usually turn off Flash and other plugins in all my browsers anyway.

collective.uploadify

The collective.uploadify product has the distinct advantage of not requiring a plugin; it just works using JavaScript.  When you install it into a Zope, it does not show up in the sites' quickinstaller; it just works if you visit the folder's URL and append "/@@upload" to the URL. For example, if you want to upload files to the root folder of the site at http://plonedev.uwosh.edu/career, visit the URL http://plonedev.uwosh.edu/career/@@upload

To make this a bit more user friendly, you can add a portal action.  Here's how I did it:

  • Go to portal_actions in the ZMI.
  • Go to the "object" folder.  
  • Add a CMFAction here.  
  • Call it "Upload", with Description "Upload files easily into this folder".  
  • For the URL expression use
    string:${object_url}/@@upload
  • For the Condition expression use
    python:plone_context_state.is_folderish()
  • For Permissions select "View".  
  • Make sure the "Visible?" check box is checked.  
  • Press Save Changes.

The Condition expression I use is shorter than what is recommended in the product's installation instructions because the one they suggest

python:portal.portal_workflow.getInfoFor(context, "review_state", default="") == "published" and plone_context_state.is_folderish()

does not work correctly in the root of a Plone 3.2 site (that may be because the root folder of a Plone 3.2 site does not have a review_state value).

Navigation