how do i stop a large file upload and redirect user to a page. can you tell
what is wrong in the code below.
if the max_file_size is reached it is not redirected, but the upload stops
and nothing happens. how do i stop the upload progress, and redirect the
user to a different page?
buffer_size = 32768#32KB
d = {'f':{}, '_unicode':False}
i = web.input(**d)
data_read = req.file.read(buffer_size)
file_size = buffer_size
while data_read:
output_file.write(data_read)
data_read = req.file.read(buffer_size)
file_size = file_size + buffer_size
if file_size > max_file_size:
return web.found('/upload?error_message=file too big, try
again')
thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---