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.

safe cracker file php error

October 20, 2011 7:55pm

Subscribe [10]
  • #1 / Oct 20, 2011 7:55pm

    atuser

    24 posts

    I’m getting this error when I try to use a safecracker file field

    Fatal error: Call to a member function result() on a non-object in /system/expressionengine/third_party/safecracker_file/ft.safecracker_file.php on line 669

    Using EE 2.3.1


    Here is my code:

    {field:my_custom_field}
  • #2 / Oct 21, 2011 12:21pm

    Mark Bowen

    12637 posts

    Hi atuser,

    Could you show us your Safecracker form code please?

    Also your code above shows this :

    {field:my_custom_field}

    Does your Safecracker File field have the shortname of my_custom_field? If not then change your code to reflect that so if for example your field is called Safecracker File with a short-name of safecracker_file then your code would need to look like this instead :

    {field:safecracker_file}

    Does that help at all?

    Thanks,

    Mark

     

  • #3 / Oct 21, 2011 12:46pm

    atuser

    24 posts

    Hi Mark,

    My safecracker file field is named: “file_upload”

    The form works fine without the safecracker file field included.

    Here is my form code:

    {exp:safecracker channel="employees_only" return="employees_only/edit/ENTRY_ID" entry_id="{segment_3}" id="safe-publish"}
    
        <label for="title">Title</label>
    
        <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100">/p>
    
        <label for="url_title">URL Title</label>
    
        <input type="text" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50"></p>
    
        {status_menu}
    
            <label for="status">Status</label>
    
            <select name="status" id="status">
                    {select_options}
            </select>
    
        {/status_menu}
    
        <label for="entry_date">Date</label>
    
        <input type="text" name="entry_date" id="entry_date" value="{entry_date}" maxlength="23" size="25"></p>
    
        <label for="expiration_date">Expiration Date</label>
    
        <input type="text" name="expiration_date" id="expiration_date" value="{expiration_date}" maxlength="23" size="25"></p>
    
        <label for="comment_expiration_date">Comment Expiration Date</label>
    
        <input type="text" name="comment_expiration_date" id="comment_expiration_date" value="{comment_expiration_date}" maxlength="23" size="25"></p>
    
    <label for="intranet_page_body">Page Body</label>
    
    {field:intranet_page_body}
    
    <label for="file_upload">File Upload</label>
    
    {field:file_upload}
    
        <label class="checkbox"><input type="checkbox" name="sticky" value="y"  {sticky}> Make Entry Sticky</label>
        <label class="checkbox"><input type="checkbox" name="allow_comments" value="y" {allow_comments}> Allow Comments</label>
        <label class="checkbox"><input type="checkbox" name="dst_enabled" value="y" {dst_enabled}> DST Active on Date of Entry</label>
    
        {if captcha}
            <label for="captcha">Please enter the word you see in the image below:</label>
    
            {captcha}
            <input type="text" name="captcha" value="{captcha_word}" maxlength="20"></p>
        {/if}
    
        <input type="submit" name="submit" value="Submit">
    {/exp:safecracker}
  • #4 / Oct 21, 2011 1:32pm

    atuser

    24 posts

    Also, I get the same error when I try to publish to this channel through the control panel.

    If I remove the safecracker file field the error goes away.

  • #5 / Oct 24, 2011 2:50pm

    atuser

    24 posts

    Any update on this?

  • #6 / Oct 24, 2011 10:49pm

    Dan Decker

    7338 posts

    atuser,

    Sorry for the delay on this. Was this 2.3.1 installation an update or a clean install? If this was an update, can you try re-uploading safecracker_file from a fresh download of ExpressionEngine? Make sure to place it in /system/expressionengine/third_party/

    Also, have you tried using the standard file field type? If so, what were the results of that?

    Cheers,

  • #7 / Oct 25, 2011 11:07pm

    FortySeven Media

    130 posts

    Actually, I’m having that issue as well. I’ve re-uploaded the field type and the third party safecracker folders. Nada.

  • #8 / Oct 25, 2011 11:30pm

    Dan Decker

    7338 posts

    Hi Jonathan,

    Are you seeing this on 2.3.1 as well? Was this a clean install or an update? As of 2.2, the only SafeCracker related item that should be in /system/expressionengine/third_party/ is safecracker_file the actual SafeCracker module has been moved into EE core. Have you attempted using the standard file field type instead of SafeCracker File field type?

    Cheers,

  • #9 / Oct 26, 2011 5:11pm

    malacandra

    6 posts

    I was seeing this too, after an upgrade from 2.2.1 to 2.3.1 - and I can report that I was only seeing the error when I specified “show existing files”.

    So, I decided to test if this only occurred if there were no associated files, I discovered when trying to upload images (which were the files I was working with) through the normal Publish/Edit interface, I was getting an error that the thumbnail directories were not writable.

    When I changed the permission of the thumbnail directories, the error went away.

    So this is likely a thumbnail directory permissions problem.

  • #10 / Oct 28, 2011 5:34pm

    Kevin Smith

    4784 posts

    Thanks for the input on this, malacandra. Jonathan and atuser, could you check the permissions of your upload folders and make sure they’re set to 777? If you do this, does the problem still present itself?

  • #11 / Oct 29, 2011 9:05pm

    Steven Grant

    894 posts

    error still exists with permissions set to 777

  • #12 / Oct 31, 2011 7:00am

    Andrew Gunstone

    102 posts

    Hey all,

    I’m getting the same issue happening with Safecracker in EE2.3.1.  Any update on this issue?

    Cheers

  • #13 / Nov 01, 2011 6:31pm

    ks808

    12 posts

    I’m also getting this error with Safecracker 2.1 in EE 2.3.0.  I do have the Matrix module installed, but it’s not being used in this particular template. Thanks!

    EDIT: After unchecking “Show Existing Files?”, the error went away.  But a new problem exists where the Safecracker field in either the CP or the template doesn’t quite work.  In the CP, the error is a “Fatal error: Allowed memory size of (xxxxx) bytes exhausted (tried to allocate (XXXX) bytes) in ../system/expressionengine/core/EE_Lang.php on line 191”.  In the template where i’m using the ajax return, I get no error.  The file does get uploaded, but just doesn’t get stored in the db.

  • #14 / Nov 01, 2011 11:47pm

    Kevin Smith

    4784 posts

    @All - I was able to replicate the issue, so I filed a bug for it here. The bug is absolutely the result of having no files in the chosen file directory along with having “Show Existing Files?” checked. Keep your eyes on that bug report for updates.

    @ks808 - How much memory do you have available to PHP? In your CP, head over to Tools > Utilities > PHP Info and let me know the value of the memory_limit line.

  • #15 / Nov 02, 2011 3:33pm

    ks808

    12 posts

    @Kevin Smith: Thanks for the update!  Can I just work around the bug by dumping some dummy images within the folder?  My memory_limit is “-1”.

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases