Python实现文件上传和下载

用Python开启web服务,在局域网内实现文件上传和下载功能

#!/usr/bin/env python3"""Simple HTTP Server With Upload.This module builds on http.server by implementing the standard GET
and HEAD requests in a fairly straightforward manner.see: https://gist.github.com/UniIsland/3346170
"""__version__ = "0.1"
__all__ = ["SimpleHTTPRequestHandler"]
__author__ = "bones7456"
__home_page__ = "https://gist.github.com/UniIsland/3346170"import os
import posixpath
import http.server
import socketserver
import urllib.request, urllib.parse, urllib.error
import html
import shutil
import mimetypes
import re
import argparse
import base64from io import BytesIOclass SimpleHTTPRequestHandler(http.server.BaseHTTPRequestHandler):"""Simple HTTP request handler with GET/HEAD/POST commands.This serves files from the current directory and any of itssubdirectories.  The MIME type for files is determined bycalling the .guess_type() method. And can reveive file uploadedby client.The GET/HEAD/POST requests are identical except that the HEADrequest omits the actual contents of the file."""server_version = "SimpleHTTPWithUpload/" + __version__def do_GET(self):"""Serve a GET request."""f = self.send_head()if f:self.copyfile(f, self.wfile)f.close()def do_HEAD(self):"""Serve a HEAD request."""f = self.send_head()if f:f.close()def do_POST(self):"""Serve a POST request."""r, info = self.deal_post_data()print((r, info, "by: ", self.client_address))f = BytesIO()f.write(b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')f.write(b"<html>\n<title>Upload Result Page</title>\n")f.write(b"<body>\n<h2>Upload Result Page</h2>\n")f.write(b"<hr>\n")if r:f.write(b"<strong>Success:</strong>")else:f.write(b"<strong>Failed:</strong>")f.write(info.encode())f.write(("<br><a href=\"%s\">back</a>" % self.headers['referer']).encode())f.write(b"<hr><small>Powered By: bones7456, check new version at ")f.write(b"<a href=\"https://gist.github.com/UniIsland/3346170\">")f.write(b"here</a>.</small></body>\n</html>\n")length = f.tell()f.seek(0)self.send_response(200)self.send_header("Content-type", "text/html")self.send_header("Content-Length", str(length))self.end_headers()if f:self.copyfile(f, self.wfile)f.close()def deal_post_data(self):uploaded_files = []content_type = self.headers['content-type']if not content_type:return (False, "Content-Type header doesn't contain boundary")boundary = content_type.split("=")[1].encode()remainbytes = int(self.headers['content-length'])line = self.rfile.readline()remainbytes -= len(line)if not boundary in line:return (False, "Content NOT begin with boundary")while remainbytes > 0:line = self.rfile.readline()remainbytes -= len(line)fn = re.findall(r'Content-Disposition.*name="file"; filename="(.*)"', line.decode())if not fn:return (False, "Can't find out file name...")path = self.translate_path(self.path)fn = os.path.join(path, fn[0])line = self.rfile.readline()remainbytes -= len(line)line = self.rfile.readline()remainbytes -= len(line)try:out = open(fn, 'wb')except IOError:return (False, "Can't create file to write, do you have permission to write?")else:with out:                    preline = self.rfile.readline()remainbytes -= len(preline)while remainbytes > 0:line = self.rfile.readline()remainbytes -= len(line)if boundary in line:preline = preline[0:-1]if preline.endswith(b'\r'):preline = preline[0:-1]out.write(preline)uploaded_files.append(fn)breakelse:out.write(preline)preline = linereturn (True, "File '%s' upload success!" % ",".join(uploaded_files))def send_head(self):"""Common code for GET and HEAD commands.This sends the response code and MIME headers.Return value is either a file object (which has to be copiedto the outputfile by the caller unless the command was HEAD,and must be closed by the caller under all circumstances), orNone, in which case the caller has nothing further to do."""path = self.translate_path(self.path)f = Noneif os.path.isdir(path):if not self.path.endswith('/'):# redirect browser - doing basically what apache doesself.send_response(301)self.send_header("Location", self.path + "/")self.end_headers()return Nonefor index in "index.html", "index.htm":index = os.path.join(path, index)if os.path.exists(index):path = indexbreakelse:return self.list_directory(path)ctype = self.guess_type(path)try:# Always read in binary mode. Opening files in text mode may cause# newline translations, making the actual size of the content# transmitted *less* than the content-length!f = open(path, 'rb')except IOError:self.send_error(404, "File not found")return Noneself.send_response(200)self.send_header("Content-type", ctype)fs = os.fstat(f.fileno())self.send_header("Content-Length", str(fs[6]))self.send_header("Last-Modified", self.date_time_string(fs.st_mtime))self.end_headers()return fdef list_directory(self, path):"""Helper to produce a directory listing (absent index.html).Return value is either a file object, or None (indicating anerror).  In either case, the headers are sent, making theinterface the same as for send_head()."""try:list = os.listdir(path)except os.error:self.send_error(404, "No permission to list directory")return Nonelist.sort(key=lambda a: a.lower())f = BytesIO()displaypath = html.escape(urllib.parse.unquote(self.path))f.write(b'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">')f.write(("<html>\n<title>Directory listing for %s</title>\n" % displaypath).encode())f.write(b'<style type="text/css">\n')f.write(b'a { text-decoration: none; }\n')f.write(b'a:link { text-decoration: none; font-weight: bold; color: #0000ff; }\n')f.write(b'a:visited { text-decoration: none; font-weight: bold; color: #0000ff; }\n')f.write(b'a:active { text-decoration: none; font-weight: bold; color: #0000ff; }\n')f.write(b'a:hover { text-decoration: none; font-weight: bold; color: #ff0000; }\n')f.write(b'</style>\n')f.write(("<body>\n<h2>Directory listing for %s</h2>\n" % displaypath).encode())f.write(b"<hr>\n")f.write(b"<form ENCTYPE=\"multipart/form-data\" method=\"post\">")f.write(b"<input name=\"file\" type=\"file\" multiple/>")f.write(b"<input type=\"submit\" value=\"upload\"/></form>\n")f.write(b"<hr>\n")f.write(b'<a href="../"><img src="https://img-blog.csdnimg.cn/2022010708445240670.gif" alt="[PARENTDIR]" width="24" height="24">&nbsp;&nbsp;&nbsp;Parent Directory</a><br />\n')for name in list:dirimage = 'data:image/gif;base64,R0lGODlhGAAYAMIAAP///7+/v7u7u1ZWVTc3NwAAAAAAAAAAACH+RFRoaXMgaWNvbiBpcyBpbiB0aGUgcHVibGljIGRvbWFpbi4gMTk5NSBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tACH5BAEAAAEALAAAAAAYABgAAANdGLrc/jAuQaulQwYBuv9cFnFfSYoPWXoq2qgrALsTYN+4QOg6veFAG2FIdMCCNgvBiAxWlq8mUseUBqGMoxWArW1xXYXWGv59b+WxNH1GV9vsNvd9jsMhxLw+70gAADs='fullname = os.path.join(path, name)displayname = linkname = name# Append / for directories or @ for symbolic linksif os.path.isdir(fullname):dirimage = 'data:image/gif;base64,R0lGODlhGAAYAMIAAP///+jNlr+/v6KXfm5SG2lPGjc3NwAAACH+RFRoaXMgaWNvb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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACwAAAAAGAAYAAAI/wCZCBxIsKDBgwgLrsigwUXChEVGYNBwIYKIJA8LFunwocKGDA8ieMg4kAiHDxRmCGyhIAEKkhtR2iCYYYEAkiNQ3ijYIQGAjDkuVFBJsIcBAhcyttCgoSCQBQcUFMn44gIFEiwE/oAqIAfJIREeQLDAZIeCAwO8IuQRowYSIxQgBFhAoQBatQaFiLCQoQIFCxEMREUwoAEPhEA0dMQwQSwCIEFYpKCR8IfiCjWYgJCr4AhJyx13CFRhQYECGBmRcKwgmmAEBCsyltBQQUfBGwUG4MjoYMOIgjsSIJBAskGGEAR3IEhw4AdJExIeyBCIY/kBHySZLNEwgcGGDQYQNBbPLpAIBgULEhB4AIQ8wRMFBIhQ4j4gADs='displayname = name + "@"if name.endswith(('.bmp','.gif','.jpg','.png')):dirimage = nameif name.endswith(('.avi','.mpg')):dirimage = 'data:image/gif;base64,R0lGODlhGAAYAMIAAP///7+/v7u7u1ZWVTc3NwAAAAAAAAAAACH+RFRoaXMgaWNvbiBpcyBpbiB0aGUgcHVibGljIGRvbWFpbi4gMTk5NSBLZXZpbiBIdWdoZXMsIGtldmluaEBlaXQuY29tACH5BAEAAAEALAAAAAAYABgAAANvGLrc/jAuQqu99BEh8OXE4GzdYJ4mQIZjNXAwp7oj+MbyKjY6ntstyg03E9ZKPoEKyLMll6UgAUCtVi07xspTYWptqBOUxXM9scfQ2Ttx+sbZifmNbiLpbEUPHy1TrIB1Xx1cFHkBW4VODmGNjQ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72l0gh6OsCYLLY60QcYYJWBQgQZUXEBIQYWYYAYnitmSCy2ldHJJGCNAQMEEK3TnVgo5jMJZLra8UoomjfjRBQghOEADfIW88AIdtdyCSyyocMJeHWd40cEPA+4SSGA+TLJLLauAIkkhesgRhxJOLCHDHgXhwVETbTjCiiuiSHIIIGo8UYghTcyAR0GgyDCAAAYMEMAJO/QwAwEAFHCAAQXIMMpBmzhSyCCD4JHGFA0FMkghMxEUEAA7'# Note: a link to a directory displays with @ and links with /f.write(('<a href="%s"><img src="%s" width="24" height="24">&nbsp;&nbsp;&nbsp;%s</a><br />\n'% (urllib.parse.quote(linkname), dirimage , html.escape(displayname))).encode())f.write(b"<hr>\n</body>\n</html>\n")length = f.tell()f.seek(0)self.send_response(200)self.send_header("Content-type", "text/html")self.send_header("Content-Length", str(length))self.end_headers()return fdef translate_path(self, path):"""Translate a /-separated PATH to the local filename syntax.Components that mean special things to the local file system(e.g. drive or directory names) are ignored.  (XXX They shouldprobably be diagnosed.)"""# abandon query parameterspath = path.split('?',1)[0]path = path.split('#',1)[0]path = posixpath.normpath(urllib.parse.unquote(path))words = path.split('/')words = [_f for _f in words if _f]path = os.getcwd()for word in words:drive, word = os.path.splitdrive(word)head, word = os.path.split(word)if word in (os.curdir, os.pardir): continuepath = os.path.join(path, word)return pathdef copyfile(self, source, outputfile):"""Copy all data between two file objects.The SOURCE argument is a file object open for reading(or anything with a read() method) and the DESTINATIONargument is a file object open for writing (oranything with a write() method).The only reason for overriding this would be to changethe block size or perhaps to replace newlines by CRLF-- note however that this the default server uses thisto copy binary data as well."""shutil.copyfileobj(source, outputfile)def guess_type(self, path):"""Guess the type of a file.Argument is a PATH (a filename).Return value is a string of the form type/subtype,usable for a MIME Content-type header.The default implementation looks the file's extensionup in the table self.extensions_map, using application/octet-streamas a default; however it would be permissible (ifslow) to look inside the data to make a better guess."""base, ext = posixpath.splitext(path)if ext in self.extensions_map:return self.extensions_map[ext]ext = ext.lower()if ext in self.extensions_map:return self.extensions_map[ext]else:return self.extensions_map['']if not mimetypes.inited:mimetypes.init() # try to read system mime.typesextensions_map = mimetypes.types_map.copy()extensions_map.update({'': 'application/octet-stream', # Default'.py': 'text/plain','.c': 'text/plain','.h': 'text/plain',})parser = argparse.ArgumentParser()
parser.add_argument('--bind', '-b', default='', metavar='ADDRESS',help='Specify alternate bind address ''[default: all interfaces]')
parser.add_argument('port', action='store',default=8000, type=int,nargs='?',help='Specify alternate port [default: 8000]')
args = parser.parse_args()PORT = args.port
BIND = args.bind
HOST = BINDif HOST == '':HOST = 'localhost'Handler = SimpleHTTPRequestHandlerwith socketserver.TCPServer((BIND, PORT), Handler) as httpd:serve_message = "Serving HTTP on {host} port {port} (http://{host}:{port}/) ..."print(serve_message.format(host=HOST, port=PORT))httpd.serve_forever()

Python实现文件上传和下载相关推荐

  1. python实现文件上传和下载_[Python] socket实现TFTP上传和下载

    一.说明 本文主要基于socket实现TFTP文件上传与下载. 测试环境:Win10/Python3.5/tftpd64. tftpd下载:根据自己的环境选择下载,地址 :http://tftpd32 ...

  2. Python实现阿里云aliyun服务器里的文件上传与下载

    Python实现阿里云服务器里的文件上传与下载 Python实现阿里云服务器里的文件上传与下载 背景: 正文: 预备环境: 构想: 实现: 注意: 结尾 018.4.15 背景: 老实说,因为现实的各 ...

  3. python实现文件上传下载

    Python实现文件上传下载 环境准备: 1. 实验分两个文件,服务端(linux)和客户端(windows). 服务端运行环境:python2.x 客户端运行环境:python3.x 2. 使用了库 ...

  4. python selenium 下载文件_Python Selenium —— 文件上传、下载,其实很简单

    很多selenium学习者被浏览器弹出的文件上传.下载框折磨的痛不欲生,今天博主就带你们轻松搞定上传和下载问题. 上传 上传弹框 文件上传是所有UI自动化测试都要面对的一个头疼问题,要处理这个问题,我 ...

  5. python程序发布到阿里云云服务器_Python实现阿里云服务器里的文件上传与下载

    Python实现阿里云服务器里的文件上传与下载 018.4.15 背景: 老实说,因为现实的各种原因造成电脑换来换去是可能出现的事情,但是电脑能换,电脑里的环境却不能换.我就曾在三个电脑里各自安装了虚 ...

  6. python解析xml提交到hdfs_完美解决python针对hdfs上传和下载的问题

    当我们使用python的hdfs包进行上传和下载文件的时候,总会出现如下问题 requests.packages.urllib3.exceptions.NewConnectionError:: Fai ...

  7. Struts2文件上传与下载

    2019独角兽企业重金招聘Python工程师标准>>> 本文主要写的是struts2 的文件上传与下载(中文文件名问题的解决).  使用的时候直接在地址栏中输入:http://loc ...

  8. python实现sftp上传和下载

    python3 sftp上传使用的是paramiko模块 #!/usr/bin/python # coding=utf-8 #sftp上传和下载单个文件上传和下载实现方式 import paramik ...

  9. Angular 文件上传与下载

    Angular文件上传与下载 文件上传 方式1 使用NG ZORRO中的组件. 文件下载 方式1 直接下载 方式2 通过HTTP请求后端数据的方式进行下载 文件上传 方式1 使用NG ZORRO中的组 ...

最新文章

  1. Python进阶07 函数对象
  2. Boost:返回报告错误report errors
  3. map and flatmap 区别
  4. 16位汇编 call调用函数 通过栈来传递参数
  5. CodeForces - 336D Vasily the Bear and Beautiful Strings(dp+组合数学)
  6. 前端学习(2422):回顾
  7. 利用Python对文件进行批量重命名——以图片文件为例
  8. MessageDigest简介
  9. 是什么让 Python 如此多才多艺?
  10. Postman教程-Pre-request Script和Tests脚本的介绍
  11. 微信小程序css方式animation动画弹幕实现
  12. 【LaTex使用总结】LaTex,pdflatex,xelatex,xetex等的区别和关系
  13. winRAR去广告版
  14. 华为鸿蒙系统操作教程_鸿蒙OS Beta版怎么使用
  15. 手机对红外探头发送数据和接受
  16. Mac网络正常但是所有浏览器无法上网问题解决
  17. 图像算法工程师的一般要求
  18. 中国金融科技50强之“百度金融”技术基因研究
  19. 【PHP发送邮件】PHP实现发送邮件
  20. mysql 1593_Linux高可用(HA)之MySQL主从复制中出现1593错误码的低级错误

热门文章

  1. 读研攻略--如何选择你的研究方向并展开学习
  2. java ca 验证失败,Apache CURL错误SSL:CA证书集,但禁用证书验证
  3. 24c512 c语言程序,msp430读写24c512程序
  4. matlab中啥叫字符串,在matlab中( )用于括住字符串.
  5. html怎么弄到excel里,html里导入excel表格数据-如何将网页中的表格快速复制到EXCEL中...
  6. 1146-Table ‘performance schema.session variables‘ doesn‘t exist
  7. 英语发音规则---ir字母组合发音规律
  8. 软件测试才是系统级别错误,软件测试部BUG级别定义
  9. SpringCloud Day12---SpringCloud Alibaba Sentinel 服务熔断与限流
  10. 树莓派4B学习笔记——IO通信篇(UART)