CCK 6.x-2.8
ImageField - 6.x-3.7
Permission:
/files drwxrwx---
/tmp drwxrwxrwt
Public method
ImageField Config:
I have an ImageField in a node. The pattern is: project_pics/[author-name]
When I upload a file, the file is successfully uploaded to that directory (before hitting Save). Once I hit save I get 5 warnings that say:
warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 53 in /home/admin/domains/mysite.net/public_html/test/sites/all/modules/filefield_paths/filefield_paths.module on line 571.
The image *is* moved to the correct folder (with the token replaced), but I still get the warnings.
I've also observed that if I create another field with the *exact same settings*, I don't get those warnings. So, here's my thought - I should just delete the old field, and create another one with the same name. Only problem is that I'll loose all the data. So, how can I migrate the data to a new field?
Comments
Comment #1
gallamine commentedOk, after much poking around, I think I've discovered the problem. I posted a detailed description in the FileField issue on the same topic.
Can someone comment on whether my solution is correct, and if there's a better way of fixing things?
Thanks
#723784: preg_match error on node_save
http://drupal.org/node/723784#comment-3569656
Comment #2
gallamine commentedActually, this didn't fix everything. While the "preg_match()" error has disappeared, the image filepath is correctly updated when the node is saved. e.g. While the image is moved to the correct directory (/files/project_pics/[author-name]/filename.jpg in my case, with [author-name] properly substituted) the filepath is still listed as /files/filename.jpg
Comment #3
gallamine commentedThe "files" table is correct - the filename and file path are set correctly to the proper location, however the $node variable is wrong and lists the old location and filename of the image (just after it gets uploaded, before the tokens are replaced in the filepath and before the file name has been pathauto'ed).
I'm struggling here.
Any thoughts?
Comment #4
gallamine commentedOk, more progress. So, since the "files" table was correct that got me thinking - maybe this is a cache issue. Turns out, it is! The $node variable cache isn't being updated once the node is saved and the image file is moved/sanitized. Any idea why that would be?
e.g. Once I clear my caches, the $node variable is fine and stores the correct path to the files.
Comment #5
quicksketchThis is a FileField Paths issue, not a bug in FileField. You've already found the relevant issue, no point in having his issue open in the wrong place.
#723784: preg_match error on node_save