We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

MH File Extension duplicating multiple uploaded images when "Rewrite Filenames?" set to "Yes"

Development and Programming

MailDog's avatar
MailDog
2 posts
16 years ago
MailDog's avatar MailDog

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

       
MailDog's avatar
MailDog
2 posts
16 years ago
MailDog's avatar MailDog

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.

       
matthewianchambers's avatar
matthewianchambers
1 posts
16 years ago
matthewianchambers's avatar matthewianchambers

Awesome - thank you so much for this fix… i’m beginning to regret using this buggy extension :(

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.