14👍
✅
Surely the name “InMemory” is a clue that the file exists in memory only, so doesn’t have a path?
1👍
Daniel Roseman is correct for the context. But if you already created/inserted the object into the database using .create(...)
or obj.save()
. The path of the image can be retrieved by using obj.<field_name>.name
.
Example:
Suppose you have a model with an image field.
my_image = models.ImageFiled(upload_to='my_upload_dir')
so,
obj = ImageModel.objects.create(image=request.FILES['image']) # let's insert it to db
image_path = obj.image.name
# will return
'my_upload_dir/myimagename.jpg'
- [Django]-How can I use RESTful services with Django + Mongoengine?
- [Django]-Django global name 'PageNotAnInteger' is not defined
- [Django]-In Django templates, `Context` is a stack. What for?
- [Django]-Django extend admin "index" view
- [Django]-Create a facebook notification with Django package facepy : [15] (#15) This method must be called with an app access_token
Source:stackexchange.com