开发者

How to implement image upload while creating a user directory if he doesn't have one in django?

I have two model in my profile that request image upload.

One is just a market place where all the images can be together, i don't care, but the other is a photo gallery. I ready many ways to upload images (most are very old - 2007/2008). and didn't really find the right way yet.

So,Here i am, hoping that i will get my answer here... Is there a a good tutorial that any one know about on how to upload a complex form (two three models inline in开发者_运维技巧 one form with image upload for every user to the user directory) ?

I know this might be two questions, but it is connected to the same issue...

10x,

Erez


Maybe you can write your own Storage class which takes into account the current user to determine the directory to store the file?

Maybe it is even possible to abuse the existing system and change the FileField.storage in for example the constructor. I am not sure if this is easily possible, and it will probably be a very dirty solution.


This is usually done with os.mkdir

http://docs.python.org/library/os.html#os.mkdir


I think i found the answer over here eventually:

Upload files by user

If I user this as the base concept, I can actually create what i am looking for....

10x everyone.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜