0

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?

forrest
  • 10,570
  • 25
  • 70
  • 132
  • Can you elaborate on "no joy"? `{field:event_icon}` should work. Does the field not show? Or does it show, but the upload doesn't work? – Derek Hogue Apr 11 '12 at 14:12
  • The field shows in both options. The first one doesn't actually upload the image even though it accepts a value. The second one is present as a link: Add File, but does not respond when I click on it. – forrest Apr 11 '12 at 14:25
  • Sounds like you're not loading the javascript required for the File fieldtype. Perhaps you've added `safecracker_head="no"`? You may also want to look at converting your field to the Safecracker File fieldtype. – Derek Hogue Apr 11 '12 at 15:20
  • Hi Derek, alas the documentation is a bit thin on this subject. What Javascript is required for the File Fieldtype? Is there more documentation? I feel like I am supposed to be a bit of a clairvoyant on this topic. – forrest Apr 11 '12 at 15:28
  • So long as you *don't* use `safecracker_head="no"`, fieldtypes should load their javascript automatically. You'll also need to load the SAEF CSS as well, [as described in the docs](http://expressionengine.com/user_guide/modules/safecracker/index.html#including-assets). – Derek Hogue Apr 11 '12 at 15:45
  • I can see the javascript code in the source file but it does not display when I click on the link. The CSS file is linked. – forrest Apr 11 '12 at 16:06
  • Do you have a live link? – Derek Hogue Apr 11 '12 at 16:08
  • Please check your email. – forrest Apr 11 '12 at 16:15

1 Answers1

1

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.

Derek Hogue
  • 4,589
  • 1
  • 15
  • 27