Peter Mott wrote: > If you upload a file using the cgi module is there any > way to discover the file name that the user submitted > as well as the file data? I've googled till I squint > but I can't find anything.
Working example (for ASP, which uses BinaryRead to get the request stream): contentLength = int(env['CONTENT_LENGTH']) content, size = request.BinaryRead(contentLength) content = StringIO.StringIO(content) form = cgi.FieldStorage(content, None, "", env, True) content.close() for key in form: value = form[key] try: filename = value.filename except AttributeError: filename = None if filename: # Store filename, filedata as a tuple. self.requestParams[key] = (filename, value.value) else: for subValue in form.getlist(key): self.requestParams[key] = subValue Robert Brewer MIS Amor Ministries [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list