[ckan-dev] path of uploaded resource in filestorage?

Maurizio "Graffio" Mazzoneschi graffio at lynxlab.com
Mon Oct 6 17:13:54 UTC 2014


Hello all,
Is there any way to know which is the file path of an uploaded file in
the file-store?

I'm writing a plugin that make the operator life more easy: I would like
convert xls in csv directly.
But I don't know how get the physical path to the file uploded.

Anyone can help me?

I've seen that in the Hard Disk I've this file:
/var/lib/ckan/default/resources/5f0/90a/10-45d6-4ebb-a2ed-db016e2b3f15

it correspond to this URL to it:
http://127.0.0.1:5000/dataset/test-be1/resource/5f090a10-45d6-4ebb-a2ed-db016e2b3f15

I understand that I can isolate the last part of the URL in this way:
* 5f0 (first 3 chars = directory 5f0 inside the dir resources)
* 90a (second 3 chars = directory 90a inside the dir resources/5f0)
* 10-45d6-4ebb-a2ed-db016e2b3f15 the name of the file

Is this always true?
Are always 3 chars?

There is others more easy ways to identify the absolute path of the
resource file?
thanks in advance

Thanks in advance
m

-- 
maurizio "graffio" mazzoneschi
Lynx s.r.l.
http://www.lynxlab.com
http://www.scoop.it/t/graffio
skype: graffio_m





More information about the ckan-dev mailing list