Resumable file uploads with wildcard.foldercontents
The tus protocol that was introduced in my previous post is now implemented in the latest wildcard.foldercontents.
In order to activate tus resumable uploads in the latest wildcard.foldercontents however, you need to do a few things.
First off
upgrade wildcard.foldercontents to the latest
Add the tus package
In the eggs section of buildout.cfg file:
eggs = ... tus ...
Add environment variables to configure tus
In buildout.cfg again, you'll need to find your zeo "client" or "instance" configuration. It'll be the buildout section with the recipe plone.recipe.zope2instance or has the line recipe = plone.recipe.zope2instance.
You'll need to add environment variable. Something like this should do:
environment-vars = TUS_ENABLED true TUS_TMP_FILE_DIR ${buildout:directory}/var/tmp
To see what other configuration options are available, read the docs.
Create the directory
If you're following the example exactly and using ${buildout:directory}/var/tmp as your temporary file directory, you'll need to create the folder:
mkdir var/tmp
If you run plone as a different users, you might have to chown own the directory. Just make sure the user the runs the Ploen process has write access to the temporary directory
Finally
Run buildout:
./bin/buildout
Warning
- resumable file uploads only works on modern browsers
- all the zeo servers running this need to be on the same physical server, have a shared tmp file directory storage or use sticky sessions in order for this to work
- current implementation uploads files in 5MB chunks and resuming works across those 5MB chunk boundaries. For instance, if an upload is interrupted after 4MB of upload, that request never actually finished uploading to Plone and the file data is never saved.
- only makes drag drop upload and upload button ON folder contents a resumable and chunking upload. Does not make existing file widgets in plone resumable.
- it's still new, expect some issues and please report any problems.