def handle_uploaded_file(file): file.name = "logo."+file.name.split('.')[1] with open('sharix_admin/static/sharix_admin/img/'+file.name, 'wb+') as destination: for chunk in file.chunks(): destination.write(chunk)