If I have understood you correctly, the media_file attribute in your model instances should hold the relative path to your file from MEDIA_ROOT. To get the absolute path to the file, just use os.path.join(settings.MEDIA_ROOT, media.media_file).
2010/1/9 tsmets <[email protected]>: > Dear, > I have a Class that allows to upload Media Files > > DEFAULT_UPLOAD_SUBFOLDER = 'upload/%Y/%m/%d' > # For the time being, the value is set to a real absolute max 200 Gb > ABSOLUTE_MAX_SIZE = 200 * 1024 * 1000 * 1024 * 1024 > > class Media(models.Model): > """ Model for any file (image, pdf, MS-document) """ > media_file = models.FileField(upload_to=DEFAULT_UPLOAD_SUBFOLDER, > max_length=ABSOLUTE_MAX_SIZE) > ... > > When posting a file via the Form : > class MediaForm(forms.ModelForm): > > class Meta: > model = Media > ... > > Every thing goes fine but for the fact that I don't know the exact > file name. > > tsm...@calvin:~/Documents/python/gramps/trunk/src/web/upload/ > 2010/01/08$ ls -la > total 20 > drwxr-xr-x 2 tsmets tsmets 4096 2010-01-09 02:07 . > drwxr-xr-x 3 tsmets tsmets 4096 2010-01-08 14:53 .. > -rwxr-xr-x 1 tsmets tsmets 856 2010-01-09 02:07 Test_1__.pdf > -rwxr-xr-x 1 tsmets tsmets 856 2010-01-08 14:55 Test_1_.pdf > -rwxr-xr-x 1 tsmets tsmets 856 2010-01-08 14:53 Test_1.pdf > > I however want to process that file and upon correct processing move > it to another folder. > Due to the fact that the folder is named : 'upload/%Y/%m/%d', I would > not like to reconstruct the folder directory name myself. > > Can someone help .. ? > > \T, > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

