Could someone give me some code (iOS side and Django side) to show me how to let iOS upload the image to Django, and Django rename it and save it in the /static/ folder.
This is my Django Model
class UserAccountInfo(models.Model): usignup_email = models.EmailField(blank=False) def __unicode__(self): return "UserAccountInfo: user signup email = ", str(self.usignup_email) def cal_image_path(instance, image_title, image_size_category): filename = str(image_title) + '_' + str(image_size_category) + '.png' return os.path.join('users', str(instance.usignup_email), filename) class UserImages(models.Model): uid = models.ForeignKey(UserAccountInfo) uimage_title = models.CharField(max_length=70) uimage_size_category = models.IntegerField() uimage = models.ImageField(upload_to=cal_image_path, blank=True, null=True) def __unicode__(self): return "UserImages: image title = %s, image size category = %s"\ % (self.uimage_title, str(self.uimage_size_category))
But I really have no idea: how iOS using POST or PUT to upload one image to Django and Django rename it and save it. Could some snippets(iOS side and Django side)