Uploading big files wit cherrypy

F

Farsheed Ashouri

I use this code to upload using cherrypy:
#========Code Start==========
class NoteServer(object):
_cp_config = { 'tools.sessions.on': True }

def index(self):
return """
<html><body>
<form action="upload" method="post" enctype="multipart/
form-data">
filename: <input type="file" name="myFile" /><br />
<input type="submit" />
</form>
<p>
Pars Studios, 2009
</p>
</body></html>
"""
#~ return compose().run()
index.exposed = True
def upload(self, myFile):
out = """<html>
<body>
myFile length: %s<br />
myFile filename: %s<br />
myFile mime-type: %s
</body>
</html>"""

# Although this just counts the file length, it demonstrates
# how to read large files in chunks instead of all at once.
# CherryPy uses Python's cgi module to read the uploaded file
# into a temporary file; myFile.file.read reads from that.
size = 0
allData=''
while True:
data = myFile.file.read(8192)
allData+=data
if not data:
break
size += len(data)
savedFile=open(myFile.filename, 'wb')
savedFile.write(allData)
savedFile.close()
return out % (size, myFile.filename, myFile.type)
#~ return allData
upload.exposed = True
#========Code End============

But I couldn't upload files bigger than 100Mb.
Why and what is workaround?

Thanks in advanced.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top