I’ve got a safecracker form on a client’s site that has a safecracker file field for uploading images to a gallery. This field is required. It *was* working at one point, but during testing it stopped working for some reason. Now when a file is added to that field, and the entry is submitted, EE kicks back a “The form you submitted contained the following errors: The Layout Image field is required” message—as if no image was selected, except that there was. Uploads work fine from the CP. So what gives with my safecracker form?
The code I’m using is below:
{exp:safecracker channel="my_channel" return="my_channel/URL_TITLE" url_title="{segment_3}"}
<label for="title">Title*</label>
<input type="text" name="title" id="title" value="{title}" size="50" maxlength="100">
<label for="layout_image">Layout Image*</label>
Image must be no larger than 600px x 600px and 200kb in size.
{field:layout_image}
<label for="layout_description">Layout Description</label>
{if field_instructions}{field_instructions}{/if}
{field:layout_description}
{if member_group == "6" OR member_group == "1"}
{custom_fields}
{if relationship}
<label for="{field_name}">{if required}* {/if}{field_label}</label>
{if field_instructions}{field_instructions}{/if}
<select id="{field_name}" name="{field_name}">
{options}
<option value="{option_value}"{selected}>{option_name}</option>
{/options}
</select>
{/if}
{/custom_fields}
{/if}
<div id="categorySelect">
<label for="categories">Categories</label>
{categories}
<input type="checkbox" name="category[]" id="categories" value="{category_id}" {checked} />
<span>{category_name}</span>
{/categories}
<div class="clear"></div>
</div>
{if captcha}
<label for="captcha">Please enter the word you see in the image below:</label>
{captcha}
<input type="text" name="captcha" value="{captcha_word}" maxlength="20">
{/if}
<label class="checkbox"><input type="checkbox" name="allow_comments" value="y" {allow_comments}> Allow Comments</label>
<input type="hidden" name="status" id="status" value="open">
<button type="submit" name="submit">Submit</button>
{/exp:safecracker}