Hi

I ran into a problem when a user named one of his upload directories "webfiles" - ec_file_autocomplete doesn't check where in the target string "files/" appears, so a path like this:

files/data/webfiles/images/foo.jpg

gets incorrectly truncated to (all copies of "files/" removed)

data/webimages/foo.jpg

rather than

data/webfiles/images/foo.jpg

Suggested fix
671c671,672
< $trimmed = trim(str_replace(variable_get('ec_file_directory_path', 'files') .'/', '', $f->filename));
---
> $replaceregex = '|^' . variable_get('ec_file_directory_path', 'files') .'/|';
> $trimmed = trim(preg_replace($replaceregex, '', $filename));

Cheers
Warren