{
"info": {
"author": "Gael Pasgrimaud",
"author_email": "gael@gawel.org",
"bugtrack_url": null,
"classifiers": [
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: JavaScript",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "The `Sphinx `_ version of this documentation can be found `here `_.\n\nA `demo `_ page is also\navailable.\n\nIf you found a bug submit an `issue `.\n\n.. contents::\n\nDescription\n***********\n\n\n`gp.fileupload` is a set of wsgi middleware to deal with large file upload.\n\n- `gp.fileupload.FileUpload` is a wsgi middleware to get the stat of large\n files uploaded to the server. Optional javascript code is provided to animate\n a progress bar.\n\n- `gp.fileupload.Storage` is a wsgi middleware to store files on file system\n and avoid big transaction in your application.\n\n\nUpload middleware\n*****************\n\nThe principle is to count uploaded chunks in the wsgi loop, transmit them to the\napplication, and provide a link with up-to-date json information. The optional\njavascript code is able to use an existing form and replace it with a progress\nbar during upload. It can also generate its own upload form, then upload several\nfiles sequentially with multiple progress bars. gp.fileupload can be used\nwithout modifying your application, just by adding it in the wsgi stack.\n\nIt has currently been tested with Pylons and Zope 3.\n\nMiddleware\n----------\n\nWrap your wsgi application with the middleware::\n\n >>> from gp.fileupload import FileUpload\n\n >>> def my_application(environ, start_response):\n ... start_response('200 OK', [('Content-Type', 'txt/html')])\n ... return ['My app']\n\n >>> app = FileUpload(my_application, tempdir=TEMP_DIR,\n ... max_size=None)\n\n >>> def application(environ, start_response):\n ... return app(environ, start_response)\n\nThe `FileUpload` middleware has the following options:\n\n- `tempdir`: A path to a temporary folder\n\n- `max_size`: Max allowed size. If the file size is larger than `max_size` a\n `RuntimeError` is raised. \n\n- `include_files`: A list of static files that the middleware should include in\n your html body (see below). You might want to include the files by yourself\n in the relevant pages, or they will be included in all of your pages.\n\n- `require_session`: a boolean flag that disable the middleware for\n requests that don't provide the SESSION_name in the query.\n\nApplication code\n----------------\n\nWrite an html form like this::\n\n \n\nWhere 1 is the session id. The session id **must** be a digit.\n\nWhen the form is submitted, you can use some ajax stuff to get the stats of the upload with the url::\n\n http://yourhost/gp.fileupload.stat/1\n\nThis will return some JSON data like::\n\n {'state': 1, 'percent': 69}\n\n`state` can have the following values:\n\n- `0`: nothing done yet.\n\n- `1`: upload is active\n\n- `-1`: file is larger than max_size.\n\nYou can use this to display the upload progress.\n\n\n\nStorage middleware\n******************\n\nThe storage middleware provide a way to avoid long transaction in your application.\n\nPOST content is written to a temporary directory. If the POST contains some\nfiles then the files are moved to the storage directory. The files content is\nreplaced by the path of the real file relative to the storage root.\n\nThis way, your application receive **always** a few Ko of data.\n\nUsage\n-----\n\nWrap your wsgi application with the middleware::\n\n >>> from gp.fileupload import Storage\n >>> from gp.fileupload import purge_files\n >>> import cgi\n\n >>> def my_application(environ, start_response):\n ... \"\"\"simple app to read the file path from the request and remove it\n ... from the storage directory\n ... \"\"\"\n ... if environ['REQUEST_METHOD'] == 'POST':\n ... fields = cgi.FieldStorage(fp=environ['wsgi.input'],\n ... environ=environ,\n ... keep_blank_values=1)\n ... relative_path = fields['file'].read()\n ... # remove file from storage\n ... purge_files(environ, relative_path)\n ... start_response('200 OK', [('Content-Type', 'txt/html')])\n ... return ['My app']\n\n >>> app = Storage(my_application,\n ... upload_to='/tmp/share/files',\n ... tempdir='/tmp/upload_tmp',\n ... )\n\n >>> def application(environ, start_response):\n ... return app(environ, start_response)\n\nThe `Storage` middleware has the following options:\n\n- `upload_to`: the root directory of the storage tree.\n\n- `tempdir`: A path to a temporary folder\n\n- `exclude_paths`: a list of regular expressions. All matched `PATH_INFO` will\n be ignored. If this parameters is not None, then the middleware will also\n catch non-HTML content send by your application. WARNING: This options is\n experimental and not well tested.\n\n- `require_session`: a boolean flag that disable the middleware for\n requests that don't provide the SESSION_name in the query.\n\nPaste factories\n***************\n\nThe package provides a filter factory usable in `PasteDeploy\n`_ configuration files.\n\nThe factory provides the middleware itself::\n\n [pipeline:main]\n pipeline = fileupload egg:myapp\n\n [filter:fileupload]\n use = egg:gp.fileupload\n # temporary directory to write streams to\n tempdir = %(here)s/data/fileupload\n\n # file to inject in the html code\n include_files = fileupload.css jquery.*\n\n # if you already have jquery in your application, use this line\n #include_files = fileupload.css jquery.fileupload.*\n\n # max upload size is 50Mo\n max_size = 50\n\n # use this options to also wrap your application with a Storage middleware\n #upload_to = %(here)s/storage\n #exclude_paths = /@@\n\nThen you can access the javascript stuff at `/gp.fileupload.static/`.\n\nThe `include_files` parameters will inject these tags in your application::\n\n \n \n\nThe `fileUpload` plugin has the following options:\n\n- `replace_existing_form`: replace the existing form with a generated one.\n Defaults to false.\n\n- `submit_label`: The label of the general submit button.\n\n- `field_name`: A string to use as file field name for each form. Default to `file`.\n\n- `hidden_submit_name`: A string to use in the hidden field name located below\n each file field. The hidden field is supposed to replace the missing button,\n and is required by form frameworks (such as z3c.form) which expect a button\n name (bound to an action). Default to `submit`.\n\n- `submit_empty_forms`: if true, submit forms with empty file fields. Default:\n true.\n\n- `use_iframes`: If set to `false` the form will be submitted as a normal form.\n If `true` the form target become an iframe and the page is not reloaded.\n\n- `stat_delay`: delay between each stat request. Default: 1500. \n\n- `success`: A javascript function evaluated when all files are uploaded. The\n default one does nothing.\n\nExamples\n--------\n\nIf you want multiple file forms::\n\n \n\n \n\nThis will show a form with addable file field and upload them to `/upload`.\nThe forms are submitted in iframes as target so the page does not change after\nuploading.\n\nIf you already have forms. This is what is done in the\n`jquery.fileupload.auto.js`::\n\n \n\nThis will show a progress bar when the form is uploaded, then redirect to the\napplication page when the upload is completed. So the usage is totally\ntransparent for you.\n\n\n\nContributors\n************\n\nGael Pasgrimaud \n\nChristophe Combelles \n\n\nNews\n****\n\n1.2 (2012-09-03)\n----------------\n\n* Use json instead of simplejson if you have Python2.6.\n\n* Fix middleware to work on Windows.\n\n* Add a flag ``require_session`` that enable the middleware only if\n there is SESSION_NAME in the query string. By default the behavior\n is off, meaning it behave like before.\n\n1.1\n---\n\n* Unrecorded changes.\n\n1.0\n---\n\n* Unrecorded changes.\n\n0.9 (2010-03-20)\n----------------\n\n* support multiple file with same name and special chars (by pfalcon)\n\n* allow JSON callback on stats (by pfalcon)\n\n\n0.8 (2009-02-20)\n----------------\n\n- fix installation problem\n\n0.7 (2009-02-08)\n----------------\n\n- fix #1. bug in js when the environ have a SCRIPT_NAME\n\n- storage improvement. (by trollfot)\n\n0.6 (2008-11-24)\n----------------\n\n- improve middleware internals using WebOb\n\n0.5 (2008-08-28)\n----------------\n\n- support readline(int). Thanks to Tony Caduto for bug report.\n\n- Added a hidden field to provide an action name\n required by form frameworks such as z3c.form\n\n- updated the doc\n\n- raised the stat update delay to 1500ms\n\n- added an option to replace the existing form with a generated one.\n\n- changed the progress filename from a span to a div\n\n- improved usability by adding a form on input:file change event\n\n- handle only POST method\n\n- improve Storage middleware\n\n0.4 (2008-08-12)\n----------------\n\n- fix egg install script\n\n- add a storage module\n\n0.3 (2008-07-27)\n----------------\n\n- fix Content-Length header sent after code injection.\n\n- add `e.stopPropagation()` to the `Add more file` link \n\n0.2 (2008-07-25)\n----------------\n\n- add docs/ folder to auto generate documentation with sphinx\n\n- use jquery packed version\n\n- IE javascript fixes \n\n0.1 (2008-07-24)\n----------------\n\n- first version",
"description_content_type": null,
"docs_url": null,
"download_url": "UNKNOWN",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://www.gawel.org/docs/gp.fileupload/",
"keywords": "wsgi middleware upload progress bar",
"license": "MIT",
"maintainer": null,
"maintainer_email": null,
"name": "gp.fileupload",
"package_url": "https://pypi.org/project/gp.fileupload/",
"platform": "UNKNOWN",
"project_url": "https://pypi.org/project/gp.fileupload/",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "http://www.gawel.org/docs/gp.fileupload/"
},
"release_url": "https://pypi.org/project/gp.fileupload/1.2/",
"requires_dist": null,
"requires_python": null,
"summary": "A WSGI middleware to get some stats on large files upload,and provide a progress bar for your users",
"version": "1.2"
},
"last_serial": 754500,
"releases": {
"0.1": [
{
"comment_text": "",
"digests": {
"md5": "e21fdd499170a72f195d3b81548d229f",
"sha256": "04e4324f055e44819da4bcb444a8fd5437c9029f5d590cc360ed1bee1768faca"
},
"downloads": -1,
"filename": "gp.fileupload-0.1.tar.gz",
"has_sig": false,
"md5_digest": "e21fdd499170a72f195d3b81548d229f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 53252,
"upload_time": "2008-07-24T19:56:18",
"url": "https://files.pythonhosted.org/packages/d7/8a/90005634e86213eea8bac7665f3bd23feb80e609ef00588881515bd9a6ac/gp.fileupload-0.1.tar.gz"
}
],
"0.2": [
{
"comment_text": "",
"digests": {
"md5": "95d30d9eae622cac6558e2b23def460e",
"sha256": "253e97b5094e3c84ec3ff42820deb00a7f3f7879f8ac3552c609d2c3458fe5b5"
},
"downloads": -1,
"filename": "gp.fileupload-0.2.tar.gz",
"has_sig": false,
"md5_digest": "95d30d9eae622cac6558e2b23def460e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 44993,
"upload_time": "2008-07-25T17:34:04",
"url": "https://files.pythonhosted.org/packages/07/9b/9408323fe543bb54764c45e804ecef390cbc9443fe52930efab998c09096/gp.fileupload-0.2.tar.gz"
}
],
"0.3": [
{
"comment_text": "",
"digests": {
"md5": "ff9630bacd49402b24b5f15411775fe3",
"sha256": "91e40b640d6408c65a4f28eb59a60afdbf37b21ec18cc7806c4772ff360e1ca9"
},
"downloads": -1,
"filename": "gp.fileupload-0.3.tar.gz",
"has_sig": false,
"md5_digest": "ff9630bacd49402b24b5f15411775fe3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 47744,
"upload_time": "2008-08-12T09:57:04",
"url": "https://files.pythonhosted.org/packages/c1/58/76a6e65e7f5f5782941d9c10a7ad424d4d233b26aeed1617614525f0db6e/gp.fileupload-0.3.tar.gz"
}
],
"0.4": [
{
"comment_text": "",
"digests": {
"md5": "8f5d855a3f94c09a9514fa3389ccc20b",
"sha256": "b56952cf4f89f68105a305b1cfe91e535d0d71915993c09d90680a382663876e"
},
"downloads": -1,
"filename": "gp.fileupload-0.4.tar.gz",
"has_sig": false,
"md5_digest": "8f5d855a3f94c09a9514fa3389ccc20b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 47808,
"upload_time": "2008-08-12T09:59:32",
"url": "https://files.pythonhosted.org/packages/b9/66/e7a7d1b2a70d47f2fdf2b539b67cd0627194b163338d65e8a3aa380db8a3/gp.fileupload-0.4.tar.gz"
}
],
"0.5": [
{
"comment_text": "",
"digests": {
"md5": "5d3aabafd6468e441edf57c44d46a72e",
"sha256": "9f081398484f2aff9b73f68ff96c0ebcccd5110c965b2c9053764f2f3df02a44"
},
"downloads": -1,
"filename": "gp.fileupload-0.5.tar.gz",
"has_sig": false,
"md5_digest": "5d3aabafd6468e441edf57c44d46a72e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 53652,
"upload_time": "2008-08-28T19:22:30",
"url": "https://files.pythonhosted.org/packages/4d/c0/82b5ce0c61920317df5426c3ed4cc554be1e245d5978825956c960c0fb25/gp.fileupload-0.5.tar.gz"
}
],
"0.6": [
{
"comment_text": "",
"digests": {
"md5": "e7c0027828664f250356cc4c93e7cc26",
"sha256": "23887e0412f1d996de57a4bf8c1fae345f77b0b43d156cb838850e3b901864eb"
},
"downloads": -1,
"filename": "gp.fileupload-0.6.tar.gz",
"has_sig": false,
"md5_digest": "e7c0027828664f250356cc4c93e7cc26",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 53202,
"upload_time": "2008-11-24T19:37:01",
"url": "https://files.pythonhosted.org/packages/af/f7/8c6b05ef8b52a34bb3613271ba643547a7a7f29bccf9aacb1d347e3a892c/gp.fileupload-0.6.tar.gz"
}
],
"0.7": [
{
"comment_text": "",
"digests": {
"md5": "cdf3ccb2d74cec665c3f4ed2830ec813",
"sha256": "614165bf6e775381b14bd6e1ec03af149b6821477d62ad37638af4f40f4fef6a"
},
"downloads": -1,
"filename": "gp.fileupload-0.7.tar.gz",
"has_sig": false,
"md5_digest": "cdf3ccb2d74cec665c3f4ed2830ec813",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 34819,
"upload_time": "2009-02-08T15:35:45",
"url": "https://files.pythonhosted.org/packages/88/74/5f6b0632baafbd0b10aee3258ed2b1ac1a6cedb7f77d3d5545a7f4430a81/gp.fileupload-0.7.tar.gz"
}
],
"0.8": [
{
"comment_text": "",
"digests": {
"md5": "56daa1ad5e9ea01297c4e2afef96e805",
"sha256": "ae4558d6d809b5f0f2efeb4abd53907a3efafa99c903f2bfc2aad4f99a56229a"
},
"downloads": -1,
"filename": "gp.fileupload-0.8.tar.gz",
"has_sig": false,
"md5_digest": "56daa1ad5e9ea01297c4e2afef96e805",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 36726,
"upload_time": "2009-02-21T11:00:40",
"url": "https://files.pythonhosted.org/packages/e9/e5/2ad1b8b1f7aabbf8e6c9da8c0f0b6da132aab1c9480723fe9a7a85e0b4c1/gp.fileupload-0.8.tar.gz"
}
],
"0.9": [
{
"comment_text": "",
"digests": {
"md5": "ec8b745ec55791cff93c5e518c2051dc",
"sha256": "e01a22139098613b7d0390d019074ec4207a50fd6cd00175c6988bc21a3708d4"
},
"downloads": -1,
"filename": "gp.fileupload-0.9.tar.gz",
"has_sig": false,
"md5_digest": "ec8b745ec55791cff93c5e518c2051dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37292,
"upload_time": "2010-03-20T11:34:45",
"url": "https://files.pythonhosted.org/packages/15/4b/f4cfb26bd475a008a1bccf027f0e9deaea3a724b1c99585e37a5e098345d/gp.fileupload-0.9.tar.gz"
}
],
"1.0": [
{
"comment_text": "",
"digests": {
"md5": "9102bb4d4b585d4e33ba8c5e05dbba63",
"sha256": "416a83c62a027110be2d4159dddc1ccb3acfddac68647be57628d7499745605b"
},
"downloads": -1,
"filename": "gp.fileupload-1.0.tar.gz",
"has_sig": false,
"md5_digest": "9102bb4d4b585d4e33ba8c5e05dbba63",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 36738,
"upload_time": "2010-06-19T17:18:45",
"url": "https://files.pythonhosted.org/packages/bf/82/2667e8949c79a553b856b0b52fa541489b02ee151683ef9a87a625e2a004/gp.fileupload-1.0.tar.gz"
}
],
"1.1": [
{
"comment_text": "",
"digests": {
"md5": "920d7ab9dc21dfd50283b1c2b9621cc0",
"sha256": "a09f1b2def9f4e0e03d8a4f20aa8f283728e18bcfbdf8139c699c5012eed92a7"
},
"downloads": -1,
"filename": "gp.fileupload-1.1.tar.gz",
"has_sig": false,
"md5_digest": "920d7ab9dc21dfd50283b1c2b9621cc0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 36798,
"upload_time": "2010-11-02T16:09:20",
"url": "https://files.pythonhosted.org/packages/14/b4/7a6e181fe808e09ebdd9ba8ed2f78094fea44d3b5210639e717d8367ec0d/gp.fileupload-1.1.tar.gz"
},
{
"comment_text": "",
"digests": {
"md5": "bf1a20fc29810fe9b82ad521c5f66044",
"sha256": "6449dcc672d638935849ed6e2594ccebbaae744cbbfe8a7dcdda9b52cb5ca86e"
},
"downloads": -1,
"filename": "gp.fileupload-1.1.zip",
"has_sig": false,
"md5_digest": "bf1a20fc29810fe9b82ad521c5f66044",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 51562,
"upload_time": "2010-11-02T16:09:18",
"url": "https://files.pythonhosted.org/packages/20/c2/a71c3aae7a5fcef4632c0037413b2403dd0f447e3332d0ab2d576c601723/gp.fileupload-1.1.zip"
}
],
"1.2": [
{
"comment_text": "",
"digests": {
"md5": "82d79a0ee390b2e903026943dc43c0d5",
"sha256": "03055defdf0974fe5e96551352d3f9182aa41199e641889daf8a031d53f358b6"
},
"downloads": -1,
"filename": "gp.fileupload-1.2.tar.gz",
"has_sig": false,
"md5_digest": "82d79a0ee390b2e903026943dc43c0d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37366,
"upload_time": "2012-09-03T13:38:30",
"url": "https://files.pythonhosted.org/packages/46/78/daeb6406e9ab0c68c64fbc368a5b144def447d9ff6622ea233e0f7470493/gp.fileupload-1.2.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "82d79a0ee390b2e903026943dc43c0d5",
"sha256": "03055defdf0974fe5e96551352d3f9182aa41199e641889daf8a031d53f358b6"
},
"downloads": -1,
"filename": "gp.fileupload-1.2.tar.gz",
"has_sig": false,
"md5_digest": "82d79a0ee390b2e903026943dc43c0d5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 37366,
"upload_time": "2012-09-03T13:38:30",
"url": "https://files.pythonhosted.org/packages/46/78/daeb6406e9ab0c68c64fbc368a5b144def447d9ff6622ea233e0f7470493/gp.fileupload-1.2.tar.gz"
}
]
}