Private
Public Access
1
0

better file names fit files

This commit is contained in:
Sander Roosendaal
2021-06-13 15:49:31 +02:00
parent 02029f8b6b
commit f3ae66f419
3 changed files with 6 additions and 2 deletions

View File

@@ -140,8 +140,10 @@ def handle_uploaded_image(i): # pragma: no cover
def handle_uploaded_file(f):
fname = f.name
timestr = uuid.uuid4().hex[:10]+'-'+time.strftime("%Y%m%d-%H%M%S")
fname = timestr+'-'+fname
ext = fname.split('.')[-1]
fname = '%s.%s' % (uuid.uuid4(),ext)
#timestr = uuid.uuid4().hex[:10]+'-'+time.strftime("%Y%m%d-%H%M%S")
#fname = timestr+'-'+fname
fname2 = 'media/'+fname
with open(fname2,'wb+') as destination:
for chunk in f.chunks():