Search code examples
pythonmultipartform-datawebapp2

get contents of multiple files using webapp2


I am uploading multiples files at the same time using

enctype="multipart/form-data" 

On the backend, I am using webapp2. I wish to access file contents of all the files uploaded. i am able to get the filenames using

def post(self):
        for file_data in self.request.POST.getall('fileToUpload'):
            self.response.out.write(file_data.filename)

However, I am not able to get the individual contents. Please help. Thanks in advance!


Solution

  • I found the answer to my question after a few more searches :

    for file_data in self.request.POST.getall('fileToUpload'):
         print "File Contents : ", file_data.value