ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safecracker and File Field

March 28, 2012 12:00pm

Subscribe [2]
  • #1 / Mar 28, 2012 12:00pm

    mark59

    88 posts

    I have a simple safecracker form

    {exp:safecracker channel="listings" return="testprofile/test3" entry_id="1"}
    {field:listingsimage}
    <input type="submit" value="Save" />
    {/exp:safecracker}

    as a single tag inside of a safecracker form

    where listingsimage is my field name for the native File field type channel field

    The image thumb displays and underneath it appears two links - labeled remove file and add file - but they do nothing. HELP.

     

     

  • #2 / Mar 29, 2012 12:51pm

    Shane Eckert

    7174 posts

    Hi mark59,

    Thank you for posting your question here on the ExpressionEngine forums.

    Is there a reason you are not using the SafeCracker File Fieldtype?

    I think you will have an easier time of this if you do that.

    To do so in the Control Panel please go to Add-Ons->Field Types and enable SafeCracker File.

    Then edit your Channel Field Type for the right channel and change it from File to SafeCracker File.

    Lastly try this in your SafeCracker form.

    {if safecracker_file}
      {display_field}
    {/if}

    Does this make sense? Please let me know if this is an option that would work for you.

    Cheers,

     

  • #3 / Mar 29, 2012 12:57pm

    mark59

    88 posts

    No that option does not work for me. I want to maintain it as the File type.

    Also the code you have given me only works inside of a {custom_fields} tag pair. I have several fields in this channel and I only want to use this particular field in the form.

    I want to use the File field type and not the Safecracker_file type and I am familiar with both.

    {field:myimagefield} works when the field type is a Safecracker File Field type - but when it is a File type it does not - I need to fix this on a live website.

    {field:my_field_shortname} works for other field types


  • #4 / Mar 29, 2012 5:08pm

    mark59

    88 posts

    Let me also clarify some further things in the safecracker module documentation in the EE 2.4 documentation set

    Custom Field Tag Pair
    
    {my_field_name}{/my_field_name}
    
    Display a custom field’s data using the Fieldtype API’s replace_tag method. Useful for fieldtypes with complex data, such as a Matrix field.
    field:my_field_name

    The above code does not work for the Matrix tag pairs inside of a safecracker tag - the documentation is wrong - you will get a PHP error. You can only use {field:my_shortname_for-the matrix_field} (see below) to access the P&T Matrix field type. Unfortunately that means an all or nothing. That is you are limited to displaying all rows and all cells for this field type - but better than nothing.

    {field:my_field_name}
    
    Display a custom field using the Fieldtype API’s display_field method. Useful for fieldtypes that use complex markup, for instance a WYSIWYG fieldtype.

    That works (and is what you should use to access P&T matrix)- but as reported here does not work for the File field type - which is the native field type for uploading files in EE. The image thumb nail appears as do the remove and add links - but the links do not work. Unless I have missed something in the documentation which is not clear.

     

  • #5 / Mar 30, 2012 5:12am

    mark59

    88 posts

    I have come across this and this would suggest that the native File field type does NOT work under safecracker. While I always viewed safecracker_file just as a replacement for the excellent ngen file add-on in EE1.X I can see now that is also about solving the File upload issue under safecracker.

    http://ellislab.com/forums/viewthread/207048/

    Can the fact that the native File field type does not work in safecracker please be documented in the Safecracker documentation.

    Others before me seem to have had this issue and I have wasted quite some valuable time looking at this, plus it has taken up a little of your support time - so please document it.

  • #6 / Apr 03, 2012 5:23pm

    Shane Eckert

    7174 posts

    Hello mark59,

    I have let the team know about your concerns with the SafeCracker Documentation.

    Aside from the documentation, is there anything else I can do for you?

    Cheers,

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases