Saving Asset field in FEEF ("Front-end entry form") using Plugin I'm having issues saving an Asset field in my FEEF using a Plugin. I have a channel with some fields added to it, one of these fields being an Asset field. When using the standard entries/saveEntry build in function in Craft the Asset gets saved.

When I try to run the same form (same channel, same field) through my Plugin everything saves except the Asset field asset. The code I'm using (below) is a slightly changed version of Pixel&amp;Tonics own "Guest Entries" Plugin.

Can anyone help me to figure out whats going on?

/**
 * Populates an EntryModel with post data.
 *
 * @access private
 * @throws HttpException
 * @return EntryModel
 */
private function _populateEntryModel()
{
    $entry = new EntryModel();

    // Set section
    $entry-&gt;sectionId   = craft()-&gt;request-&gt;getRequiredPost('sectionId');
    $this-&gt;_section     = craft()-&gt;sections-&gt;getSectionById($entry-&gt;sectionId);
    $this-&gt;_entryTypeId = craft()-&gt;request-&gt;getPost('entryTypeId');

    // Default
    $entry-&gt;authorId    = 1;
    $entry-&gt;enabled     = true;

    // Set title
    $entry-&gt;getContent()-&gt;title = craft()-&gt;request-&gt;getPost('title');

    // Set Entry type
    if($this-&gt;_entryTypeId)
    {
        $entry-&gt;typeId = $this-&gt;_entryTypeId;
    }

    // Add dynamic fields
    $entry-&gt;setContentFromPost(craft()-&gt;request-&gt;getParam('fields'));

    // Return model
    return $entry;
}


This is how my form looks (I've removed some styling and keept the essentials)

&lt;form method="post" action="" accept-charset="UTF-8" enctype="multipart/form-data"&gt;

&lt;!-- Hidden --&gt;
{{ getCsrfInput() }}
&lt;input type="hidden" name="action" value="forms/saveEntry"&gt;
&lt;input type="hidden" name="redirect" value="{{ craft.request.url }}?sent=1"&gt;
&lt;input type="hidden" name="sectionId" value="13"&gt;
&lt;input type="hidden" name="entryTypeId" value="18"&gt;
&lt;input type="hidden" name="title" class="title" value=""/&gt;

&lt;input type="text" name="fields[formName]" value="{% if formEntry.formName is defined %}{{ formEntry.formName }}{% endif %}" class="default-field name" /&gt;
&lt;input type="text" name="fields[formConfirmationNumber]" value="{% if formEntry.formConfirmationNumber is defined %}{{ formEntry.formConfirmationNumber }}{% endif %}" class="default-field" /&gt;
&lt;input type="text" name="fields[formRoom]" value="{% if formEntry.formRoom is defined %}{{ formEntry.formRoom }}{% endif %}" class="default-field" /&gt;
&lt;input type="file" name="fields[formFile]"&gt;

&lt;/form&gt;


The name="title" field gets set dynamic...
Here's the issue:

// Add dynamic fields
$entry-&gt;setContentFromPost(craft()-&gt;request-&gt;getParam('fields'));


setContentFromPost requires that if you pass any uploaded files in, you need to pass the field name as a string, instead of the actual posted values.

Changing it to this and it should work:

$entry-&gt;setContentFromPost('fields');