Good Day,
I would like to save the content of the zip file. My code works, but they save only the filename and not the content or actual files neither in the database nor the project.
I need to save in the database the content of each file. Can someone please help me to fix my error? My code looks like this:
uploaded_file, = request.FILES.getlist('document[]')
with zipfile.ZipFile(uploaded_file.file, mode="r") as archive:
for zippedFileName in archive.namelist():
newZipFile = UploadedFile(document= zippedFileName)
newZipFile.user= request.user
files = newZipFile.save()
success=True
return render(request, 'uploader/index.html', {'files': [uploaded_file]})