0

I need to obtain path from a FileField, in order to check it against a given file system path, to know if the file I am inserting into mongo database is already present. Is it possible?

All I get is a GridFSProxy, but I am unable to understand how to handle it.

gc5
  • 9,468
  • 24
  • 90
  • 151

1 Answers1

1

You can't since it stores the data into database. If you need to store the original path then you can create an EmbeddedDocument which contains a FileField and a StringField with the path string. But remember that the stored file and the file you might find on that path are not the same

chachan
  • 2,382
  • 1
  • 26
  • 41
  • I just see your posting date. I hope this could be helpful for someone else – chachan Dec 19 '12 at 22:45
  • Thanks for you answer.. In the end I figured out that every file I put into database it's, as you said, stored directly into database (not only its reference). So comparing it to a file in the file system doesn't make sense, because it does not refer to original path. – gc5 Dec 20 '12 at 15:40