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