Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

root/branches/cherrypy-2.1/docs/book/xml/fileuploadbehavior.xml

Revision 633 (checked in by fumanchu, 3 years ago)

1. Initial content for designchoices.xml.
2. Updates to gettingstarted.xml.

Line 
1 <?xml version="1.0" encoding="UTF-8"?>
2 <section xmlns:db="http://docbook.org/docbook-ng"
3          xmlns:xi="http://www.w3.org/2001/XInclude"
4          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5          xml:id="globaloverviewcherrypy">
6     <title>File upload</title>
7     <para>Before version 2.1, CherryPy handled file uploads by reading the
8     entire file into memory, storing it in a string, and passing it to the
9     page handler method. This worked well for small files, but not so well for
10     large files.</para>
11     <para>CherryPy 2.1 uses the python <code>cgi</code> module to parse the
12     POST data. When a file is being uploaded, the <code>cgi</code> module
13     stores it in a temp file and returns a <code>FieldStorage</code> instance
14     which contains information about this file. CherryPy then passes this
15     <code>FieldStorage</code> instance to the method. The
16     <code>FieldStorage</code> instance has the following attributes:</para>
17     <itemizedlist>
18         <listitem><code>file</code>: the file(-like) object from which you can
19         read the data</listitem>
20         <listitem><code>filename</code>: the client-side filename</listitem>
21         <listitem><code>type</code>: the content-type of the file</listitem>
22     </itemizedlist>
23 </section>
Note: See TracBrowser for help on using the browser.

Hosted by WebFaction

Log in as guest/cpguest to create tickets