Commit ed268c24 by aagusti

perbaikan upload

1 parent f4684762
......@@ -399,7 +399,7 @@ class SaveFile(object):
# number.
def create_fullpath(self, ext=''):
while True:
filename = get_random_string() + ext
filename = get_random_string(32) + ext
full_path = os.path.join(self.dir_path, filename)
if not os.path.exists(full_path):
return full_path
......@@ -478,14 +478,15 @@ class Upload(SaveFile):
return filename
def save_fp(self, upload):
if 'fp' not in upload or upload['fp'] == b'':
if 'fp' not in upload or upload['fp'] == b'' or not upload['fp'] or not upload['size']:
if "filename" in upload:
return upload['filename']
return
filename = upload['filename']
input_file = upload['fp']
ext = get_ext(filename)
return self.save_to_file(input_file, ext)
filename = self.save_to_file(input_file, ext)
return os.path.split(filename)[1]
def saves(self, uploads):
d = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!