def unzip_file(upload_file, extension='.shp', tempdir=None):
 absolute_base_file = None
 if (tempdir is None):
  tempdir = tempfile.mkdtemp()
 the_zip = ZipFile(upload_file)
 the_zip.extractall(tempdir)
 for item in the_zip.namelist():
  if item.endswith(extension):
   absolute_base_file = os.path.join(tempdir, item)
 return absolute_base_file

def unzip_file ( upload_file , extension = '.shp' , tempdir = None ) : absolute_base_file = None if ( tempdir is None ) : tempdir = tempfile . mkdtemp ( ) the_zip = ZipFile ( upload_file ) the_zip . extractall ( tempdir ) for item in the_zip . namelist ( ) : if item . endswith ( extension ) : absolute_base_file = os . path . join ( tempdir , item ) return absolute_base_file
unzip the file to the destination location .