![]() Return value is either a file object (which has to be copied This sends the response code and MIME headers. """Common code for GET and HEAD commands. Return (True, "File '%s' upload success!" % ",".join(uploaded_files)) Return (False, "Can't create file to write, do you have permission to write?") Return (False, "Can't find out file name.") Return (False, "Content NOT begin with boundary")įn = re.findall(r'Content-Disposition.*name="file" filename="(.*)"', code()) ![]() Return (False, "Content-Type header doesn't contain boundary")īoundary = content_type.split("=").encode() nd_header("Content-Length", str(length))Ĭontent_type = self.headers Print((r, info, "by: ", self.client_address))į.write(("back" % self.headers).encode()) Server_version = "SimpleHTTPWithUpload/" + _version_ Request omits the actual contents of the file. The GET/HEAD/POST requests are identical except that the HEAD The MIME type for files is determined byĬalling the. This serves files from the current directory and any of its """Simple HTTP request handler with GET/HEAD/POST commands. Import urllib.request, urllib.parse, urllib.errorĬlass SimpleHTTPRequestHandler(): This module builds on BaseHTTPServer by implementing the standard GETĪnd HEAD requests in a fairly straightforward manner. The easiest solution is to run this python script within the directory I want to share/upload from/to: #!/usr/bin/env python3 ![]() I wanted to use an FTP server just to share files to and from my Mac. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |