def img_file_path(instance, filename):
    """ Creates a filepath and name for an image file. """
ext = filename.split('.')[-1]
filename = '%s.%s' % (uuid.uuid4(), ext)
today = datetime.date.today()
return os.path.join('imgs', '%s/%s/%s' % (today.year, today.month, today.
    day), filename)


class MyModel(models.Model):
    myimg = models.ImageField(upload_to=img_file_path)

def save(self, *args, **kwargs):
    path_of_file = self.myimg.name
self.myimg.name = path_of_file.upper()
super(MyModel, self).save()
Optimize Django model save method for accessing to uploaded file path