Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <form name="pyform" method="POST" action="upload.py">
  2. <input type="file" name="image" /><br />
  3. <input type="submit" name="submit" value="Submit" />
  4. </form>
  5.  
  6. #!c:/Python34/python
  7. # -*- coding: UTF-8 -*-
  8. print("Content-Type: text/html")
  9. print()
  10.  
  11. import cgi,cgitb
  12. cgitb.enable()
  13.  
  14. form = cgi.FieldStorage()
  15. file = form['image'].value
  16.  
  17. upload_dir = 'C:/wamp/www/upload/' # esse é o diretório onde vou salvar a imagem
  18.  
  19. f = open(upload_dir + file, 'w')
  20. f.write(file)
  21. f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement