Hi Remy
Controlling the full filepath in the filesystem is a bit tricky, especially if you only want to control the path for certain files. It's actually the upload_to function on the filer File model and the used storage backend that determine the final file path. If you only care about the filename and not about the rest of the path, you can set it on the File object after uploading (using djangos SimpleUploadedFile.name, I think). Filer will keep that filename but change the path. If you are using secure storage backends with filer, the path might change when you change permissions. But the filename should stay the same.
If you want to completely control the path, it will be a bit more involved and you'll have to override the FILER_STORAGES setting to provide your own upload_to/storage backend.
Cheers
Stefan
Hi Remy
Hmm. I confused your case with another thread on the mailing-list. I thought you were uploading from a custom form. So the SimpleUploadedFile modification won't work.
yeah, instance.name is just a "pretty name" and has nothing to do with the actual filename.
It really depends based on what information you'd like to modify the filename. What information should the filename contain?
You'll probably have to override upload_to after all.
https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
http://django-filer.readthedocs.org/en/0.9.4/settings.html#filer-storages (you need to override FILER_STORAGE.public.main.UPLOAD_TO)
"instance" in upload_to will be the filer.File instance that is being created on upload.
Cheers
Stefan
Awesome that you found a solution :-)
by_date used to be the default, but I changed it to random.
The problem is, that date based is not unique. So if you upload a file with the same name twice on the same day, it will add a "_" to the end of the filename to keep it unique.
The random path solves that problem and also obfuscates file urls. So you can upload files that only people who know the url can download.
Cheers
Stefan