'Saving a zipfile into directory using django

I am trying to save the zip file into one directory on my server.

First, I am uploading a zip file using form and in python, I want to save it in one directory for further use.

I got some piece of code after googling

import os
from zipfile import ZipFile

def processZipFile(request):
    if request.method == 'POST' and request.FILES['frmUploadZipFile']:
        frmUploadZipFile = request.FILES['frmUploadZipFile']
        zipf = ZipFile(frmUploadZipFile, 'w')
        zipdir('/data/apps/nms/maps/', zipf)

def zipdir(path, ziph):
    for root, dirs, files in os.walk(path):
        for file in files:
            ziph.write(os.path.join(root, file))

Finally, after running this, I am getting some _ApRssiStore.txt file inserted in that folder. But not the zip file. I don't know whats happening in between.

**Updated**


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source