gp.fileupload Gawel's repository

Previous topic

Storage middleware

Next topic

Ajax stuff

This Page

Paste factories

The package provides a filter factory usable in PasteDeploy configuration files.

The factory provides the middleware itself:

[pipeline:main]
pipeline = fileupload egg:myapp

[filter:fileupload]
use = egg:gp.fileupload
# temporary directory to write streams to
tempdir = %(here)s/data/fileupload

# file to inject in the html code
include_files = fileupload.css jquery.*

# if you already have jquery in your application, use this line
#include_files = fileupload.css jquery.fileupload.*

# max upload size is 50Mo
max_size = 50

# use this options to also wrap your application with a Storage middleware
#upload_to = %(here)s/storage
#exclude_paths = /@@

Then you can access the javascript stuff at /gp.fileupload.static/.

The include_files parameters will inject these tags in your application:

<link type="text/css" rel="Stylesheet" media="screen"
      href="/gp.fileupload.static/fileupload.css"/>
<script type="text/javascript"
        src="/gp.fileupload.static/jquery.js"/>
<script type="text/javascript"
        src="/gp.fileupload.static/jquery.fileupload.js"/>
<script type="text/javascript"
        src="/gp.fileupload.static/jquery.fileupload.auto.js"/>

And feel free to use ajax stuff. Notice that these tags are included at the end of the html body.

Available files are:

  • jquery.js: jquery 1.2.6
  • jquery.fileupload.js: the jQuery().fileUpload plugin.
  • jquery.fileupload.auto.js: auto bind form tags with a multipart/form-data enctype.
  • fileupload.css: a few css to display the progress bar.