Hey again. I've got a site that's largely dependent on attached files to flexinodes, but the moment two files are submitted with the same name, everything goes to hell. Drupal creates a second file with an incremented _0 or _1 on it - so far, so good. But heaven help if you try to link to that new file!
How on earth is one supposed to tell Drupal to find this second file?
I've searched all the content I can find, but I haven't found anything. I'm currently using print file_create_url($node->flexinode_5->filepath); , and that does creates a link to the correct file, but because it's using filepath, that link doesn't actually find the file, even though it's at the correct location. Using filename instead only returns the first file.
http://example.com/system/files?file=test.pdf works, being the first instance of the file uploaded, but
http://example.com/system/files?file=test_0.pdf does not, even though the files exists and the link is completely valid.
Does anybody know how to rig this up correctly?
Comments
I think this looks pretty
I think this looks pretty identical to this issue
http://drupal.org/node/59411
and thinking about it, my solution is pretty much useless if someone creates two separate pieces of content with the same file. Although If your relying on a single piece of content per name the above works just fine.
Ta
Adam
I can't find that code
I can't find that code anywhere in my installation - is that from the 4.7 flexinode? I'm running 4.6 on this site, and unfortunately, pretty much every submission to the site is probably going to have roughly the same name. =)
I was also hoping to find some way to change the increment from file_number to file_authorname_date...