Search code examples
expressionengine

Expression Engine - How do I upload an image using SafeCracker?


I am new to SafeCracker and while I have been able to enter most other input types, the File input type is not working correctly for me.

Here is the code I am using on field type File named event_icon

<label for="event_icon"><span>*Event Icon:</span>
   <input type="file" name="event_icon" value="{event_icon}">
</label>

I also tried:

<label for="event_icon"><span>*Event Icon:</span>
 {field:event_icon}
</label>

No joy.

Any suggestions?


Solution

  • Hmm, not sure what's happening exactly, but you have a javascript error on your page that's coming from the EE javascript output relating to the File field.

    Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    /?&ACT=10&action=setup&_=1334166664318
    

    I'd try changing the File field to Safecracker File, it's a much simpler fieldtype.