Eric,
I should mention… Personally, I have never used the MH File for more than one upload at a time, so I have not noticed the problem(s) that you are experiencing.
As an alternative solution, you might try this file upload extension:
nGen File Field for ExpressionEngine
Requires PHP 5 to run (FieldFrame 1.3.4 needs PHP 5+), but it looks like a decent extension.
Hi Narendra,
Are you using the latest version of the extension?
What version of EE are you on?
If you ignore the notice message, does the extension still function?
A php notice is not a show stopper… If you log out, I am guessing you do not see the notice?
Can you post your template code.
As a quick and dirty fix, you could crack open the file extension and change 452 to this:
$key = @$pref['key'];
I would like to see your template code though…
Good luck!
Cheers, Micky
Hey Mark,
Just a quick note that the documentation is slightly off. In the code example you’ve got
{images backspace="6"}
{if file_path}{file_path}
{/if}
{if file_thumb_path}{file_thumb_path}
{/if}
{/images}
But the variables file_path and and file_thumb_path appear to be wrong. Shouldn’t that be file_url and file_thumb_url?
Cheers
This is in reference to mhulse’s most excellent help at this post.
Sorry. It took quite some time (as I thought it would) to get access to the backend at GoD***y (looks like I am cussing doesn’t it?) to look at the database. The additional preferences for this extension is kept in the table exp_mh_file. Each preference is stored individually with a loop here in the file ext.mh_file_ext.php. On line 492 there is a bug:
$pref_results = $DB->query("SELECT * FROM exp_mh_file WHERE exp_mh_file.upload_id='{$id}' AND exp_mh_file.key='{$key}'");
if (!$pref_results) {
$DB->query("INSERT INTO exp_mh_file VALUES('', {$id}, '{$key}', '{$value}')");
}else{
$DB->query("UPDATE exp_mh_file SET exp_mh_file.value='{$value}' WHERE exp_mh_file.upload_id='{$id}' AND exp_mh_file.key='{$key}'");
}
The if clause looks like the culprit. It needs to be:
if ($pref_results->num_rows == 0)
Even if the query is empty, the object that the query is assigned to is not. The variable $pref_results will test non empty if the query returns no results. See the docs here for testing for a null query result.
Change the code and it stores the prefs just fine.
I can’t seem to get this working properly: I’m using this extension multiple times on a page, some single images, some single files and some groups of images. Among other things, I’ve got a couple in a list:
{programme-music-cue-sheet}<li><a href="http://{file_url}">Download music cue sheet (pdf)</a></li>{/programme-music-cue-sheet}
{programme-script}<li><a href="http://{file_url}">Download script (pdf)</a></li>{/programme-script}
Weirdly, if I delete one (either one) it works. But having both of these in causes the template to crash (everything is displayed except for the weblog:entries tag that contains all the File tags.
I saw someone recommend not mixing single with paired tags - have changed them all to pairs but still not working… I’ve also checked that I’m using the right names of all custom fields. I’m using the latest version of the extension and EE 1.6.8.
Any ideas?
EDIT: I just found that it was related to some File tags further down the page. I’m building an image gallery like so:
{programme-gallery-images}
<li{if count=="3"||count=="6"||count=="9"||count=="12"} class="last-in-row"{/if}>/scripts/phpthumb/phpThumb.php?src={file_url}&w=220&h=126&zc=1&q=80&fltr;[]=usm|60|0.5|3</li>
{/programme-gallery-images}
For some reason, when I had more than 4 images in this gallery, it was crashing the page (this only happened when I also had all the other File tags on the page. I tried removing the if count==”3”… part and that seems to have fixed it. Not sure why…
Apologies for two posts in a row, but stuck on something new now:
Is there a way to provide alternative content when your File field is empty? I’ve tried
{image}{if file_url}{file_url}{/if}{if:else}/images/my-backup-image.gif{/if}{/image}
… and …
{image}{file_url}{if no_results}/images/my-backup-image.gif{/if}{/image}
But neither of those seem to do it… Am I missing something obvious?
Ah, sorry! that was a typo when I copied it over - should have spotted that! I did correct that and also tried your way but still no joy. I’ve found another way with PHP:
<?php
// get main image URL, or if not available use default image
$mainImageURL = "{video-image}";
if ($mainImageURL == '') {
$mainImageURL = "/images/site/default-prog-image.gif";
}
?>
I then just echo $mainImageURL whenever I need it. So all working, but slightly confused still why I couldn’t get an IF/ELSE statement working inside the File tags…
Hi there, I’m having trouble with the {count} parameter.
When I try to display it inside the variable pair, it displays the count of the weblog entry.
Am I missing something?
My code is:
{exp:weblog:entries weblog="sculpture" limit="1"}
{sculpture_image}
Total Results: {total_results}
Counter: {count}
{/sculpture_image}
{/exp:weblog:entries}
The total results displays correctly, but the count gets stuck in 1 everytime as if was displaying the {count} from the {exp:weblog:entries} tag.
Anyone knows what could be wrong?
Thanks!
Guys– I strongly suggest you check out nGen File as a replacement to the no-longer-in-development File extension:
After upgrading from 1.6.7 to 1.6.8 when I try to log in to the Control Panel I’m getting this error message:
– Unable to load the following extension file: ext.mh_file_ext.php.
– Now I only have ext.cp_jquery.php and index.html in my Extensions directory in my System directory but I can’t log in to my control panel.
Help?
Did you remove all the other extensions to try and solve the problem, or did you remove them before the upgrade? When you removed them did you disable them first?
Try placing the ext.mh_file_ext.php back in your extensions folder.
Re-reading your post - can you log in but can’t see the control panel, or can you not even get to the login prompt?
Can you go straight to the extensions list by adding “C=admin&M=utilities&P=extensions_manager” onto your URL and possibly disable all extensions?
Failing that, try editing the database table: exp_extensions delete any rows that have “Mh_file_EXT” in the class column.
The problem regarding extensions is discussed in this thread. Thanks for your help.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.