I know there are a bazillion MH File threads, so apologies if this should be located somewhere else. I also searched the forum and couldn’t come up with anything appropriate.
Anyway, the problem:
Uploading x images through a “multi” MH File field gives me x copies of the FIRST image. If I add y images on a second submission, I get x copies of the original image, plus y copies of the first image of the second batch.
It seems to be that the filename rewriter is only generating ONE rewritten filename, and loading all the images into the same place - if I disable “Rewrite Filenames” then everything works as expected.
“Rewrite Filenames” is essential for what I’m doing. Is this a known bug? Or perhaps something to do with my config (MH_FE 3.1.1, EE 1.6.4, PHP 5.2, Mac OS X server - verified issue with both Safari 3 and Firefox 3)?
I can work around by setting multiple single-file custom fields, but kinda defeats the point…
Thanks in advance
Solved my own problem - the bug is in the rewrite filenames portion of the extension. Replace this line:
767: $file_names[$file_key] = $this->_code().$file['ext'];
with this one:
767: $file_names[$file_key] = $this->_code().'-'.$file_name;
$this->_code() does not regenerate for each upload, so we just slap the filename on to the end. The _code is unique for each upload (I assume) so as long as you’re not uploading two files with the same name IN THE SAME BATCH then you’re sorted.
EDIT
Removed $file[‘ext’] as $file_name includes the extension.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.