file upload with twisted
![](https://secure.gravatar.com/avatar/dc76338db8ebade1577b2144bc1997ba.jpg?s=120&d=mm&r=g)
When i send a http request with a big file, can i check the content-length then enable or disable the file upload? I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota. how can i do this?
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
On Jan 4, 2013, at 5:50 PM, Levi Nie <levinie001@gmail.com> wrote:
When i send a http request with a big file, can i check the content-length then enable or disable the file upload?
I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota.
how can i do this?
This s3cmd? https://github.com/s3tools/s3cmd/blob/master/s3cmd It doesn't look like it uses Twisted, so I don't think this is a question for this list.
![](https://secure.gravatar.com/avatar/bf44356892ec4e4193f6fcc755afec5f.jpg?s=120&d=mm&r=g)
I resolve same problem in self project, reimplement method handleContentChunk in server.Request My code: <code># For maximum handleContentChunkLength = 0 def handleContentChunk(self, data): """ Write a chunk of data. """ self.handleContentChunkLength += len(data) if self.handleContentChunkLength >= WEB_LIMIT_REQUEST_SIZE: self.transport.write(b"HTTP/1.1 413 Request Entity Too Large\r\n\r\n") self.transport.loseConnection() # Raise to log error raise ValueError('Maximum length equal') self.content.write(data)</code> On Sat, Jan 5, 2013 at 10:14 AM, Glyph <glyph@twistedmatrix.com> wrote:
On Jan 4, 2013, at 5:50 PM, Levi Nie <levinie001@gmail.com> wrote:
When i send a http request with a big file, can i check the content-length then enable or disable the file upload?
I use the s3cmd client sent the request. And i need disable the file upload if the file size is over the quota.
how can i do this?
This s3cmd? https://github.com/s3tools/s3cmd/blob/master/s3cmd
It doesn't look like it uses Twisted, so I don't think this is a question for this list.
_______________________________________________ Twisted-web mailing list Twisted-web@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
participants (3)
-
Glyph
-
Levi Nie
-
Аркадий Левин