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.

php error with safecracker file - json

September 13, 2012 12:10pm

Subscribe [1]
  • #1 / Sep 13, 2012 12:10pm

    domandtom

    1 posts

    Sorry if this is answered else where or silly but I’m very new to EE (just started this week!) so I’m new to trouble shooting it as well.

    I have a very simple template set up like so:

    {exp:safecracker channel="claims" id="claimForm"  json="yes" return="{path=embeds/_ajax_challenge_4}"}
      <h1>create a challenge</h1>
        <label for="photo"><span>step 3:</span> create your own entry! upload a photo that proves your point.</label>
        <input type="file" name="photo" class="userInput">
        <input type="text" name="title" id="title" value="{title}" size="25" maxlength="100" class="userInput"> 
        <input type="submit" name="submit" value="next >>">
        {!-- <input type="hidden" name="challenge" id="challenge" value="{segment_3}"> --}
        <a href="http://{path=embeds/_ajax_challenge_4}class=continue">continue without entering yet</a>
    {/exp:safecracker}

    It submits fine and the image is uploaded and everything but the json response come back with the following:

    <div>

    A PHP Error was encountered

    Severity: Notice
    Message:  Undefined index: photo
    Filename: libraries/safecracker_lib.php
    Line Number: 1286

    </div>{"success":1,"errors":[],"field_errors":[],"entry_id":"35","url_title":"dsfhsdh","channel_id":"2"}

    Thanks in advance for the help and apologies again if this belongs else where.

  • #2 / Sep 13, 2012 5:49pm

    domandtom

    1 posts

    figured it out!

    I had

    <input type="file" name="photo" class="userInput">

    When I should have used

    {field:photo}

  • #3 / Sep 14, 2012 6:00pm

    Kevin Smith

    4784 posts

    Glad you figured it out, domandtom! Anything else we can help with?

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

ExpressionEngine News!

#eecms, #events, #releases