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 not uploading image files

December 24, 2011 10:49pm

Subscribe [3]
  • #1 / Dec 24, 2011 10:49pm

    noobEE

    5 posts

    Hey, everyone. Please pardon the n00b question. I’m building a classifieds site and am using Safecracker to allow non-members to create ads (entries). Given my inexperience with EE, I started by picking up the basic example from here. Here’s what I’ve got at the moment:

    {exp:safecracker channel="cars" return="cars"}
    Title:<input name="title" type="text"></p>
    Model Year:<input name="model_year" type="text"></p>
    Make:<input name="make" type="text"></p>
    Model:<input name="model" type="text"></p>
    Price:<input name="price" type="text"></p>
    Photo:<input name="photo1" type="file"></p>
    <input type="submit" value="Submit"></p>
    {/exp:safecracker}

    Upon submission all of the text entries are published but not the image. The file upload directory is set to allow members to upload files, but the image never makes it there. No errors or anything. Everything works fine when publishing through the CP. Just upgraded from 2.2.2 to 2.3.1 tonight, hoping that would make a difference but it did not.

    Yes, I’ve seen this handled more elegantly with the {custom_fields} loop and {if file}, but I’m starting basic with what makes sense given my limited knowledge. Plus this method gives me the simple file upload dialog, which I prefer to the file manager.

    In searching the forums I’ve seen lots of discussion about the safecracker file input type vs. the file input type, but I can’t make sense of it.

    Feels like I’m close, but I know too little. Can someone give me some insight?

    Thanks!

  • #2 / Dec 25, 2011 7:33am

    ahmad saad

    364 posts

    u can simply used {field:my_field_name} to show the file field.(in your case {field:photo1})

    Unfortunately, you can’nt use Standard File field types. What you suggest sounds like an excellent Feature Request!

  • #3 / Dec 26, 2011 2:25pm

    Kyle Cotter

    730 posts

    Hey noobEE,

    What fieldtype are you using for the file? Since you are using SafeCracker, you need to be using the SafeCracker File fieldtype for this.

    Can you confirm this is what you are using?

    Thanks.

  • #4 / Dec 26, 2011 10:02pm

    noobEE

    5 posts

    Thanks, Kyle. I’m using File, both in the Custom Field Settings…
    http://casemier.com/images/fieldtype.png
    ...as well as in the template (see code above).

    I’ve heard a lot of people in the forums talking about the safecracker file field type, but haven’t found a syntax reference for it yet. Is there supposed to be a safecracker file option in my Custom Field Settings, or am I supposed to use type=“safecracker_file” or some such in my template?

    Jeff

  • #5 / Dec 27, 2011 11:15am

    Kyle Cotter

    730 posts

    Hi Jeff,

    If you head over to “Add-Ons -> Fieldtypes” you should see a list of all of your fieldtypes. There should be a fieldtype called “SafeCracker File” in that list. Go ahead and click “Install” if it is not installed already.

    Then, when you go to add a Custom Field to a Channel, you should see “SafeCracker File” in that list of fieldtypes you linked to as a screenshot above.

    By doing this and using SafeCracker File instead of the regular File field, your issues should be solved on the front end.

    Keep me posted on your progress. Thanks!

  • #6 / Dec 27, 2011 1:58pm

    noobEE

    5 posts

    THANK YOU, KYLE! Works perfectly, now.

    So simple and yet so hidden. It would help tremendously if that field type was installed when Safecracker was enabled.

    Thanks, again.
    Jeff

  • #7 / Dec 27, 2011 2:37pm

    Kyle Cotter

    730 posts

    Hey Jeff,

    Glad to see you’re all up and running! 😊

    If you think that’s a feature you would benefit from in ExpressionEngine, feel free to make a feature request.

    Thanks Jeff, if you have any more questions, feel free to open a new thread.

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

ExpressionEngine News!

#eecms, #events, #releases