Dave-ee Jones Posted December 18, 2017 Share Posted December 18, 2017 (edited) Hoi! So I'm trying to upload a file using a HTML form.. <input class="form-control" id="file" name="file" type="file"/> And then save it to a file using my Python webserver (standard TCP SimpleHTTPServer). However, I'm not sure how I would do this because the form also has other inputs in it (checkboxes, text boxes etc.) and therefore am not sure how I would go about it. I'm using the CGI method to grab the variables from the POST: LENGTH = int(self.headers["Content-length"]) VARIABLES = cgi.parse_qs(self.rfile.read(LENGTH),keep_blank_values=1) And I get a list of the form objects' names and their values, except I'm not sure how to handle the file's one. Has anyone got an idea of how to go about this? Am stuck, so any help is appreciated! :) Any alternatives to this would be considered too, as I'm not very happy with this mucky way of doing this.. Edited December 18, 2017 by Dave-ee Jones Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.