python - Upload multiple files with Tornado Web Server and Nginx -


i developing upload multiple files python + tornado + nginx web server. have changed properties of nginx server follows:

client_body_buffer_size 512k; client_max_body_size 500m;

however, when sending quantity greater 3 files, not forward room. happening?

on internet , here on stack overflow examples single file, or against, creating multiple

the code below:

python

class uploadhandler(tornado.web.requesthandler):     def post(self):         try :             t = len(self.request.files)+1             x = 0             n = 'file'             while x <= t:                 nn = self.request.files[n][x]                 nome_arquivo = nn['filename']                 output_file = open("my directory/" + nome_arquivo, 'w')                 output_file.write(nn['body'])                 x+=1              self.render(             "sucess.html"                 )         except indexerror:             self.render(             "sucess.html"             ) 

html

<form enctype="multipart/form-data" method="post" action="/uploads"> <input name="descricao" type="text" /> <br> <input type="file" name="file" multiple /> <input type="submit" value="send file(s)"> </form> 

friends, solved creating 1 index. before, didn't have it.

final resolution:

class uploadhandler(tornado.web.requesthandler):     def post(self):         try :             t = len(self.request.files)             x = 1             indice = 0             n = 'file'             while x <= t:                 nn = self.request.files[n][indice]                 nome_arquivo = nn['filename']                 output_file = open("static/arquivos/" + nome_arquivo, 'w')                 output_file.write(nn['body'])                 indice+=1              self.render(             "sucess.html"                 )         except indexerror:             self.render(             "sucess.html" # necessary command while don't achieved implement             )             # x+=1 - don't know why...                           # resolution, error showed redirected                           # @ same if success 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -