title: Can't open and read content of an uploaded zip file with FastAPI
body: <p>I am currently developing a little backend project for myself with the Python Framework FastAPI. I made an endpoint, where the user should be able to upload 2 files, while the first one is a zip-file (which contains X .xmls) and the latter a normal .xml file.</p>
  <p>The code is as follows:</p>
  <pre><code>@router.post(&quot;/sendxmlinzip/&quot;)
  def create_upload_files_with_zip(files: List[UploadFile] = File(...)):
      if not len(files) == 2:
          raise Httpex.EXPECTEDTWOFILES
      my_file = files[0].file
      zfile = zipfile.ZipFile(my_file, 'r')
      filelist = []
      for finfo in zfile.infolist():
          print(finfo)
          ifile = zfile.open(finfo)
          line_list = ifile.readlines()
          print(line_list)
  </code></pre>
  <p>This should print the content of the files, that are in the .zip file, but it raises the Exception</p>
  <blockquote>
  <p>AttributeError: 'SpooledTemporaryFile' object has no attribute 'seekable'</p>
  </blockquote>
  <p>In the row <code>ifile = zfile.open(finfo)</code></p>
  <p>Upon approximately 3 days research with a lot of trial and error involved, trying to use different functions such as .read() or .extract(), I gave up. Because the python docs literally state, that this should be possible in this way...</p>
  <p>For you, who do not know about FastAPI, it's a backend fw for Restful Webservices and is using the starlette datastructure for UploadFile. Please forgive me, if I have overseen something VERY obvious, but I literally tried to check every corner, that may have been the possible cause of the error such as:</p>
  <ul>
  <li>Check, whether another implementation is possible</li>
  <li>Check, that the .zip file is correct</li>
  <li>Check, that I attach the correct file (lol)</li>
  <li>Debug to see, whether the actual data, that comes to the backend is indeed the .zip file</li>
  </ul>