Me too…
MySQL ERROR: Error Number: 1064 Description: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ON DUPLICATE KEY UPDATE id=values(id), `key`=values(`key`), val Query: INSERT INTO exp_mh_file VALUES(”, 3, ‘allow_multiple’, ‘no’) ON DUPLICATE KEY UPDATE id=values(id), `key`=values(`key`), value=values(value)
elemental:
Please check and report back as to which version of MySQL you are running. I posted at a MySQL forum and have discovered that the clause “ON DUPLICATE KEY UPDATE” in the query that you and I are having problems with did not come out until version 4.1. If this is true (I am on 4.0.26) I need to write a workaround.
From PHPmyadmin I have these stats. Thanks for looking into that.
Server version: 4.0.27-log MySQL client version: 4.0.20
ADD: And yes I tried it on a local MAMP configuration where MySQL is 5 and there is no error. So it must be the thing you found. So either we can patch the extension or make the host upgrade the MySQL.
Elemental: I have requested the upgrade. It may be long enough that I will either not use the File extension (even though it is cool) or do the patch. The offending code has a loop that goes through and stuffs the preferences in the database. It seems that we could change the code to delete the preferences first and then add the new preferences. A simple delete query and then an insert query.
foreach($_POST as $key=>$value)
{
if(substr($key, 0, 8) != 'mh_file_') continue;
$key = $DB->escape_str(substr($key, 8));
$value = $DB->escape_str($value);
//Add delete query here
//Convert this query to a simple insert
$DB->query("INSERT INTO exp_mh_file VALUES('', {$id}, '{$key}', '{$value}') ON DUPLICATE KEY UPDATE id=values(id), `key`=values(`key`), value=values(value)");
unset($_POST['mh_file_'.$key]);
}
This problem also exists on line 147 - I would think the same strategy might work there.
PS. I wonder if the writer of this most excellent extension (Mark Huot) is doing OK? The last time he posted was in December. He must be tied up with a big project.
We want SAEF and adjustable thumbnail sizes!The issue I had in getting SAEF to work is that the form generated by EE needs enctype==”multipart/form-data”. I ended up creating an extension based off what Phoebe posted sometime ago. Her code ended up giving me issues and would not enable/disable. I have attached the file I created and the only option you need to change is…Change /post/images to the path of your SAEF - so, if your image upload form is located at http://www.domain.com/myform/ - you would have the following…$options['hidden_fields']['URI']=='/post/images/'
As far as the SAEF, I hardcode my image fields like so…$options['hidden_fields']['URI']=='/myform/'
Note: I only allow 1 image upload per file field. So, if I want the ability to upload 4 files I end up having 4 file fields. If you want multiple image uploads per field I assume you would need to add functions to mod.weblog_standalone.php as Senor Dave posted, although I have not tested that functionality.<input type="hidden" name="field_id_11" value="" /> <input name="field_id_11_img[]" type="file" class="file" />
Ok I have all this working now but do you have a fix for keeping the field contents when clicking preview. I have this working for all other fields except File.
Still no luck I’m afraid -
I have this code at the top of my page (with PHP turned on)
<?php
if (isset($_POST['field_id_45'])) {
$field_id_45 = $_POST['field_id_45'];
}
else {
$field_id_45 = "";
}
?>
and this for the file field -
Upload Your Photo
<input type="file" name="field_id_45_img[]" class="file" value="<?php echo $field_id_45;?>" />
<input type="hidden" name="field_id_45" value="" />
I’ve tried adding _img and _img[] in the echo variable but no joy.
A little help if anyone can…
I had FILE working great with 1.6 and v2 of file - and now am on the verge of having 1.6.2 and 3.1.1 working fine in SAEF mode.
My question is this - where do I tell the system that I want a 100px thumbnail generated for each file uploaded? This used to be somewhere I could find - I think it was in the extension settings, which don’t exist anymore. Now I can set the resizing prefs there (in this case 400x400 auto) but I don’t see a separate place to say “please make thumbs also, 100px wide please for this upload directory”.
Anyway when I do file uploads with the SAEF the thumbs aren’t being created, and when i create an entry and upload through the Publish tab, it doesn’t do it either.
OK figured out that if I just check “show thumbnails” that it creates them for me- cool, but not very clear…
check that… its showing a small version (thumb) of the full size image. So, how do I have it generate a 100px version of the images- what am I missing. It is uploading and resizing correctly…
Also, how do I call the thumbs in my template? Used to be {custom_field_name_thumb} - same now? I am not using multi upload.
Ok here’s an interesting one.
If I use the loop method to create a list of photos using the custom field name like this -
{accomm_photo}
<li>{file_url}</li>
{/accomm_photo}
I get a nice list of all uploaded pics but if I do it this way -
{accomm_photo}
<li>{accomm_photo}</li>
{/accomm_photo}
I get a list of the same photo.
I want to list the thumbnails so I use this -
{accomm_photo}
<li>{accomm_photo_thumb}</li>
{/accomm_photo}
but again I list of the same thumbnails repeated for as many pics as I have uploaded.
Has anyone else got a way round this?
Hi,
I have just installed this extension and added the necessary custom field. When I go to publish I get the error:
“Notice: Undefined index: server_path in /home/fhlinux152/g/example.com/user/htdocs/ee/system/extensions/ext.mh_file_ext.php on line 521”
I DO have a server path set in the File Upload preferences, so I am not sure what the problem is.
I have searched the forum to see if anyone has had similar issues, but I haven’t found an answer. Any help on this would be superb. Thanks in advance.
I am running into the same problem as Eric Snyder & Elemental. I get a MySQL Error, 1064 for sure. I am running a pretty dated version of MySQL on our server as it is a Media Temple DV2.0. I could upgrade MySQL on our server but I am afraid that could cause a lot more issues. Waiting for an update from Mark that addresses this issue.
This thing is working rather nicely, but I was wondering if there’s a way you can easily display the little icons (PDF, Word, Excel) along links to files on public pages, just as you see them on the Edit page after you upload them. Maybe I missed this as I was perusing the 26 pages of discussion here.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.