Hiya,
Many thanks for posting the code above but if possible could I push for some more help with this? Sorry about this but I just cannot get it to work at all. What I have at the moment is the SAEF which is the standard boiler-plate EE code.
I have a field called photos-download with an id of 22 (pretty sure that number is correct) and then in my SAEF I have placed the following code :
<b>Main Image</b>
{embed="photographers/saef_edit_form_file_field_empty" field_number="22" field_name="{photos-download}"}
I then created the template photographers/saef_edit_form_file_field_empty and placed in the code that you provided above :
Then I get stuck!! If I view the SAEF as it is at the moment then I do get the file upload field showing and I can click on the Browse… button to find a file and it places the URL into the field but then if I submit the form it comes up with a MySQL error.
I’m not really too sure what the other two pieces of code that you posted above are for or where to place them in the scheme of things so any more help with this would be massively appreciated.
Sorry about this. I think that I have been having a thicko day today as just about everything has been going wrong unfortunately!! :-(
Thanks again for any more help with this.
Best wishes,
Mark
Hiya,
Sorry just thought I would post the error that I got when doing all of this :
MySQL ERROR:
Error Number: 1054
Description: Unknown column 'field_id_20_img' in 'field list'
Query: INSERT INTO `exp_weblog_data` (`entry_id`, `weblog_id`, `field_ft_17`, `field_ft_18`, `field_ft_20`, `field_id_20`, `field_id_20_img`, `field_id_17`, `field_id_18`, `field_id_20_img_0`, `site_id`) VALUES ('71', '3', 'br', 'none', 'none', '', 'Array', '', '', 'To Do.rtf', '1')
Also do I need to implement any of the hacks that were in this thread earlier on such as the hack to the mod.weblog_standalone.php file and the bit where you need to add in some Javascript? EDIT: I just tried adding in the ‘enctype’ => ‘multipart/form-data’ line into the mod.weblog.standalone.php file and if I do that then the SAEF won’t show up at all so I am guessing that I don’t need this bit afterall? Thanks again for any help with this.
Best wishes,
Mark
Okay now you’re going to wish you had never said that you would help me out!! 😊
I just tried again with adding the :
'enctype' => 'multipart/form-data'
into the mod.weblog.standalone.php file but typed it in by hand and now the form appears!! I can choose a file and the URL goes into the field. If I then submit the form then the text data goes into the weblog entry with no problems and it also seems as though the form is taking a while to work as I am uploading a file but when I check in the FTP there is no file uploaded and also when I check out the entry in the EDIT panel there is no URL listed in the photos-download field.
Sorry for being a complete and utter pain on this but I really do think that I must be on a thicko day today!! :-(
Thanks again for any more help on this.
Best wishes,
Mark
Hi T,
Yes there are no problems with the upload button in the Publish page. I can upload to any of the file upload directories of my choosing. That was another question I was going to ask actually. How exactly does this method know where to upload the file to?
When I click on the Browse button it just brings up the standard file browser allows me to find a file and then puts the details into the file field.
I have attached an image to show what the form looks like at the moment.
Any more help with this would be greatly appreciated.
Best wishes,
Mark
Hi T,
Thanks for the support on this. I have some good news!! I must be a complete dolt today! I hadn’t made the field in the weblog fields setup into a File field!!! I thought that because I was using the SAEF that this was separate to the setting of the weblog field. Just turned this on for that field and it now uploads!!
The only problem I have now is that the images are being resized. I uploaded a 400KB image and it got resized to around 90KB and was also width and height wise a lot smaller than the original.
Do you happen to know of any reason as to why this might be?
Thanks again.
Best wishes,
Mark
Now I really am becoming a pain!!
I looked into the code of the File extension and saw an if resize !== false code and changed it to say if resize == false instead. This gets rid of the problem with the resizing of the images using the latest version of the extension. Not sure where the resize part is coming from though.
The only problem that I now have is that any files that have spaces in them are not having these replaced with underscores and so I can’t use the Extract URL plugin on them.
Also with the code that you provided above I’m not really too sure where the Extract URL part and the PHPThumb bit come into play as I now have a form which has a browse button, I click it, choose my file and submit the form and all the data goes into the weblog and the file is uploaded so not too sure where they do their magic?
Any more help with this would be greatly appreciated. The bit I would really like to get fixed is the naming of the files as I can live with having to have hacked the code to stop the thumbnails from happening although if anyone has any ideas to that as well then that would be a bonus!! 😊
Thanks again.
Best wishes,
Mark
I looked into the code of the File extension and saw an if resize !== false code and changed it to say if resize == false instead. This gets rid of the problem with the resizing of the images using the latest version of the extension. Not sure where the resize part is coming from though.
Forgot to mention that we are not using the 2.1.2 version of File. As you can see from this post, I am getting the resize happening too. We reverted to 2.1.0 in the mean time.
The only problem that I now have is that any files that have spaces in them are not having these replaced with underscores and so I can’t use the Extract URL plugin on them.
Indeed, that is a known problem, see this thread. I will PM you about this 😊
Also with the code that you provided above I’m not really too sure where the Extract URL part and the PHPThumb bit come into play as I now have a form which has a browse button, I click it, choose my file and submit the form and all the data goes into the weblog and the file is uploaded so not too sure where they do their magic?
Oh yeah, I forgot we are PhpThumb Happy. We use it everywhere. You can just choose not to show a little preview. I do believe you should be albe to somehow grab the thumbnail that File creates. Its name will be file file name plus a “_t” before the extension.
Hiya T,
Thanks for the reply. Do you know where I can get hold of the 2.1.0 version as I can’t see it on this site any more and I only have a 1.0.7 version and then the two versions that are listed at the start of all these posts for this thread.
Thanks for all the help on this.
Best wishes,
Mark
There is apparently a fix that Mark Bowen figured out:
I looked into the code of the File extension and saw an if resize !== false code and changed it to say if resize == false instead. This gets rid of the problem with the resizing of the images using the latest version of the extension. Not sure where the resize part is coming from though.
But nothing official yet. Reverting to 2.1.0 is the best bet.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.