[Twisted-Python] How to use .rpy do upload ?

Leon square.erica at msa.hinet.net
Mon Nov 29 02:35:40 MST 2004


<!--upload page-->
<form method="POST" enctype="multipart/form-data" action="test.rpy">
                <input type="file" name="filename">
                <input type="submit">
</form>

#rpy script
from twisted.web.resource import Resource
class test(Resource):
        def render_POST(self,request):
                f = open("/root/basic_daemon/htdocs/test/test.txt","wb") #absolute path,the path must use chmod modify authorization
                f.write(request.args.get('filename')[0])
                f.close()
                return "<html><body>" + 'success' + "</body></html>"
resource = test()

----by Leon----
  ----- Original Message ----- 
  From: Iap, Singuan 
  To: leon_lee at thecus.com 
  Sent: Monday, November 29, 2004 4:56 PM
  Subject: FW: [Twisted-Python] How to use .rpy do upload ?


  If you got answer. 
  Why not answer yourself onto the post?

  singuan



------------------------------------------------------------------------------
  From: twisted-python-bounces at twistedmatrix.com [mailto:twisted-python-bounces at twistedmatrix.com] On Behalf Of Leon
  Sent: Monday, November 29, 2004 11:43 AM
  To: twisted-python at twistedmatrix.com
  Subject: [Twisted-Python] How to use .rpy do upload ?


  I  am a beginner,how can use .rpy do upload ???
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20041129/38ae207b/attachment.html>


More information about the Twisted-Python mailing list