the upload works, but i have a question about deleting the image or file: will the file also be deleted at the server? i’ve got the deleting part working, but the file is not deleted from the server ..
Hi Gert, could I ask how you managed to get the delete working from a SAEF (Stand Alone Edit Form)? Do you also have edits working with no problem? I’m seeing the related custom field ending up cleared if I save an edit in the SAEF without selecting a new file to upload…
Hey guys, I’m having problems with this too. Here’s my code:
<div id="sidebar">
{if logged_out}You are not logged in. ({if logged_out}<a href="http://{path=clients/login}">Log In</a>{/if}){/if}
{if logged_in}Logged in as {screen_name}. ({exp:logout_redirect url="http://www.woodsidesystems.net/eengine/index.php/clients/" text="Logout" styles="class='logout-link-class' title='Logout'"}){/if}
{if logged_in && member_group!="1" && segment_2=="upload"}
<h2>Upload a File</h2>
Use this form to upload a file that you would like us to review.
<fieldset id="file_upload_form">
{exp:weblog:entry_form weblog="client_uploads" return="clients/thank_you" status="Open"}
<label for="file_title">File title:</label>
<input type="text" name="title" value="{title}" id="title" size="30"/></p>
<label for="file_upload">Upload file:</label>
<input type="hidden" name="field_id_4" value="" /><input name="field_id_4_img[]" type="file" class="file" >
{custom_fields}
{if textarea}
<label for="file_description">Description:</label>
<textarea id="{field_name}" name="{field_name}" rows="{rows}" cols="30">{field_data}</textarea></p>
{/if}
{/custom_fields}
<input type="submit" value="Submit"></p>
{/exp:weblog:entry_form}
</fieldset>
{/if}
</div>
All the fields upload just fine except for the file (in case of my testing, using a TXT file). Also works fine when done through the control panel. I have the _img[] on there, what else is missing or wrong?
I always get a Mysql error
here is the error
MySQL ERROR:
Error Number: 1054
Description: Unknown column 'field_id_19_img' in 'field list'
Query: INSERT INTO `exp_weblog_data` (`entry_id`, `weblog_id`, `field_ft_8`, `field_ft_10`, `field_ft_9`, `field_ft_30`, `field_ft_11`, `field_ft_12`, `field_ft_13`, `field_ft_14`, `field_ft_15`, `field_ft_16`, `field_ft_38`, `field_ft_39`, `field_ft_17`, `field_ft_18`, `field_ft_19`, `field_ft_36`, `field_ft_21`, `field_ft_22`, `field_ft_23`, `field_ft_31`, `field_ft_32`, `field_ft_57`, `field_ft_60`, `field_id_8`, `field_id_10`, `field_id_9`, `field_id_30`, `field_id_11`, `field_id_12`, `field_id_13`, `field_id_14`, `field_id_15`, `field_id_16`, `field_id_38`, `field_id_39`, `field_id_17`, `field_id_18`, `field_id_36`, `field_id_21`, `field_id_22`, `field_id_31`, `field_id_32`, `field_id_57`, `field_id_19_img`, `field_id_19`, `field_id_19_img_0`, `site_id`) VALUES ('4029', '6', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'xhtml', 'xhtml', 'none', 'none', 'none', 'file', 'xhtml', 'xhtml', 'none', 'xhtml', 'none', 'none', 'xhtml', 'xhtml', 'hgh', 'gh', 'ghh', 'Waals-Brabant', 'ghgh', 'gh', '', 'ggg', '', '', '', '', '', '', '', '', '', '', '', '', 'Array', '', 'debruyntest.jpg', '1')
{exp:weblog:entry_form weblog="offices" return="site/index" preview="site/entry" show_fields="not pakket"}
{preview}
<h1>{title}</h1>
{display_custom_fields}
{/preview}
<table>
<tr>
<td>
Title
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"></p>
<input type="hidden" name="url_title" id='url_title' value="{url_title}" maxlength="75" size="50" class="txt"/></p>
{custom_fields}
{if required}* {/if}{field_label}
{field_instructions}
{if textarea}
<textarea id="{field_name}" name="{field_name}" dir="{text_direction}" cols="50" rows="{rows}">{field_data}</textarea><br >
{/if}
{if textinput}
<input type="text" dir="{text_direction}" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"><br >
{/if}
{if pulldown}
<select id="{field_name}" name="{field_name}">
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
</select>
{/if}
{if date}
<input type="text" id="{field_name}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50">
{/if}
{if relationship}
<select id="{field_name}" name="{field_name}">
{options}<option value="{option_value}"{selected}>{option_name}</option>{/options}
</select>
{/if}
{/custom_fields}
{category_menu}
Categories
<select name="category[]" size="10" multiple="multiple">
{select_options}
</select>
{/category_menu}
<label for="content">File Upload:</label>
<input class="labelfirst" name="field_id_19_img[]" id="file_browser" type="file" value="" />
<input type="hidden" value="" class="file" name="field_id_19"/>
<input type="hidden" value="file" class="file" name="field_ft_19"/>
<input type="submit" name="submit" value="Submit" />
</td>
</tr>
</table>
{/exp:weblog:entry_form}
I have no idea what the problem is
I always get a Mysql error here is the errorMySQL ERROR: Error Number: 1054 Description: Unknown column 'field_id_19_img' in 'field list' Query: INSERT INTO `exp_weblog_data` (`entry_id`, `weblog_id`, `field_ft_8`, `field_ft_10`, `field_ft_9`, `field_ft_30`, `field_ft_11`, `field_ft_12`, `field_ft_13`, `field_ft_14`, `field_ft_15`, `field_ft_16`, `field_ft_38`, `field_ft_39`, `field_ft_17`, `field_ft_18`, `field_ft_19`, `field_ft_36`, `field_ft_21`, `field_ft_22`, `field_ft_23`, `field_ft_31`, `field_ft_32`, `field_ft_57`, `field_ft_60`, `field_id_8`, `field_id_10`, `field_id_9`, `field_id_30`, `field_id_11`, `field_id_12`, `field_id_13`, `field_id_14`, `field_id_15`, `field_id_16`, `field_id_38`, `field_id_39`, `field_id_17`, `field_id_18`, `field_id_36`, `field_id_21`, `field_id_22`, `field_id_31`, `field_id_32`, `field_id_57`, `field_id_19_img`, `field_id_19`, `field_id_19_img_0`, `site_id`) VALUES ('4029', '6', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'none', 'xhtml', 'xhtml', 'none', 'none', 'none', 'file', 'xhtml', 'xhtml', 'none', 'xhtml', 'none', 'none', 'xhtml', 'xhtml', 'hgh', 'gh', 'ghh', 'Waals-Brabant', 'ghgh', 'gh', '[email protected]', 'ggg', '', '', '', '', '', '', '', '', '', '', '', '', 'Array', '', 'debruyntest.jpg', '1')
Try deleting that custom field, then reinstalling the extension, then set up the custom field again. Find out what custom field id it is and replace ‘19’ with whatever the new custom field id is.
Ok so I tried to add the code outlined here to an edit form but if I submit the form without selecting a file to upload then the original file reference in the custom field is cleared. If I submit a new file it uploads fine but does not ‘replace’ the original for this weblog entry…
I use javascript to actually move the file upload fields in and out of the form. The user checks a checkbox, which uses javascript to move the innerHTML of a div outside of the form to a div on the inside of the form. Essentially you’re submitting a form with an empty file upload field, which deletes the data. When you submit the form without the file upload fields it ignores that field.
Got a little question here…
I’ve followed the examples from this thread. My form does work without the file upload. I found my custom file field ID through the Admin… Here is my SAEF code:
{exp:weblog:entry_form weblog="fan-mail" return="animatch-fanmail/thank-you" preview="site/entry"}
<label for="Subject">Subject:</label>
<input name="title" id="title" type="text" value="{title}" class="textField"/>
{custom_fields}
{if textarea}
<label for="fan-message">Message:</label>
<textarea name="{field_name}" cols="10" rows="{rows}" id="{field_name}" class="textField">{field_data}</textarea>
{/if}
{if textinput}
<label for="{field_label}">{field_label}</label>
<input type="text" dir="{text_direction}" name="{field_name}" value="{field_data}" maxlength="{maxlength}" size="50"></p>
{/if}
{/custom_fields}
<label for="content">Upload Picture:</label>
<input type="hidden" name="field_id_33" value="" />
<input name="field_id_33_img[]" type="file" class="file" />
<input width="61" type="image" height="27" name="submitForm" value="submit" src="http://animatch.org/images/but-submit.gif" alt="Submit" class="submit"/>
{/exp:weblog:entry_form}
The form does submit and gets to the redirect… Then I check my Edit Entries and I do see the new submitted Entry… BUT the file doesn’t show up in the custom File field… It is set to required so if the form didn’t have the image it should be asking for the required field on submit I guess… no?
Is there something i could be doing wrong somewhere?
Any suggestion is welcome…I’ve been on this for a few hours now and I really can’t find the bug…
Thanks in advance…
I’ve tried using the same code as above with my field names and all I get is a blank screen when I upload images and text. Without uploading any images everything is fine. I can also upload using the CP. Any suggestions? Has anyone ran into the problem of getting a blank screen after uploading files?
I’ve tried using the same code as above with my field names and all I get is a blank screen when I upload images and text. Without uploading any images everything is fine. I can also upload using the CP. Any suggestions? Has anyone ran into the problem of getting a blank screen after uploading files?
Make sure you have your file upload location settings correctly set.
Hello all!
I seem to have run into an issue with this set-up. This is in conjunction with Mark’s File 3.1.1, EE 1.6.6 and an SAEF.
I have my SAEF established and in it I’m using 5 custom “Flie” fields. Only one is required, and if the user only chooses to upload one file my testing shows no issues. However, is the user selects more than one file to upload (usually 3 or more) I get the following PHP error:
Fatal error: Call to a member function show_user_error() on a non-object in /home/mysite/public_html/system/extensions/ext.mh_file_ext.php on line 857
I’m not sure what is causing this. A look at the extension at #857 is not very helpful since it looks as if this is simply for “Error reporting”.
Just to be sure this wasn’t related to exceeding File or Post Size limits I’ve bumped these limits up from their default of 8M to 15M (though this seems to not have any affect).
Oddly enough, if I back-up to Version 2.1.2. I encounter none of this. Everything seems to be smooth sailing. Admittedly, this is based on a limited amount of testing but it seems to look a.o.k.
V3.1.1 does have several features that I’d love to take advantage of but if I can’t resolve it will not be the end of the world for me if I’m using 2.1.2.
Wondering if anyone else has come across this type of issue. Note, when using 3.1.1 via the CP this does not occur.
Thoughts?
Thanks.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.