Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form name="pyform" method="POST" action="upload.py">
- <input type="file" name="image" /><br />
- <input type="submit" name="submit" value="Submit" />
- </form>
- #!c:/Python34/python
- # -*- coding: UTF-8 -*-
- print("Content-Type: text/html")
- print()
- import cgi,cgitb
- cgitb.enable()
- form = cgi.FieldStorage()
- file = form['image'].value
- upload_dir = 'C:/wamp/www/upload/' # esse é o diretório onde vou salvar a imagem
- f = open(upload_dir + file, 'w')
- f.write(file)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement