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 File - thumbnail / "Undo Remove" functionality only works in Chrome?

March 28, 2012 3:37am

Subscribe [3]
  • #1 / Mar 28, 2012 3:37am

    Bjørn Børresen

    629 posts

    Hi,

    I’ve set up a simple test channel in EE 2.4 with a SafeCracker File field that allows uploading by guests from the frontend.

    If I submit the form without specifying a title I will get the error notifying me that the title field is required (see image I’ve attached to this post). The image I had selected is remembered so I only need to specify the title and then do a resubmit to save the entry. Also there’s a thumbnail of the image with a fancy remove image icon and an “Undo remove” if I choose to remove the image.

    This works very well.

    But it only works in Chrome. Not Safari, nor IE or Firefox, or any other browser I’ve tested in.

    In all other browsers the image is cleared and I need to select/upload it over again when I get the “Title is required” error.

    Here’s the template I’m using in full:
    http://pastebin.com/raw.php?i=mVjXEU8x

    And here’s the Field Group for that channel: http://i.imgur.com/DYNYs.png

  • #2 / Mar 29, 2012 10:31am

    Shane Eckert

    7174 posts

    Hi Bjorn,

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

    Can you try the following?

    {if safecracker_file}
      {display_field}
    {/if}

    This works for me cross browser. The image stays and the preview thumbnail with the red X sticks around as well.

    I am unable to reproduce this.

    Please let me know if you have the same results with the code above.

    Cheers,

  • #3 / Apr 02, 2012 3:51am

    Bjørn Børresen

    629 posts

    Hm, that code does nothing.

    I’m assuming “safecracker_file” is the fieldname? I tried both {if safecracker_file} and {if my_field_name} .. nothing displays.

  • #4 / Apr 03, 2012 8:54am

    Bjørn Børresen

    629 posts

    Any update?

    You can test the functionality online here: http://bit.ly/HcvAUY

    Select an image, don’t fill out anything else and click the button at the bottom. In Chrome it works here. In any other browser it will clear the image.

    The template code used is similar to the code in my original post.

  • #5 / Apr 04, 2012 3:10pm

    Shane Eckert

    7174 posts

    Hey Bjørn,

    I still cannot reproduce this.

    Can you please show me the code you are using? I will take that and try myself. If this is a bug, I would love to track it down and get it taken care of.

    Cheers,

  • #6 / Apr 06, 2012 6:31am

    Bjørn Børresen

    629 posts

    The code I’m using is linked to in my initial message (the pastebin link).

    Are you not able to reproduce this on this website: http://bit.ly/HcvAUY ?

    What happens if you select an image there and just hit the button at the bottom? Do you get the image on the next page or does it not remember the image? For me this works in Chrome, but no other browsers.

  • #7 / Apr 09, 2012 3:17pm

    Shane Eckert

    7174 posts

    Hello Bjørn Børresen,

    I get the same result in both Chrome and Firefox on that link. There was no image shown upon failure. This is different than I remember and more of the fields are showing an error messages now.

    Taking the code that you have me and pasting it into my 2.4 install and changing just the channel, I get the results that I have attached here. In Firefox, the image is shown even with two fields missing.

    This does not make any sense, why are we getting different results?

    When you use the code you sent me, you are saying that in Chrome it works for you, but not in Firefox? I wonder if the file_field settings are the same. Does yours differ from mine by much? See attached.

    I am on a Mac using Chrome and Firefox. Maybe our OS is different? Are you on Windows?

    I may have another team mate check, though I am not sure any of us have a Windows box!

    Let me know about your settings.

    Cheers,

  • #8 / Apr 10, 2012 2:43am

    Bjørn Børresen

    629 posts

    I get the same result in both Chrome and Firefox on that link. There was no image shown upon failure.

    That’s the same result I get in Firefox, but in my Chrome it works as expected (thumbnail). Very strange that the functionality works locally for you but not on that link ..(?)

    When you use the code you sent me, you are saying that in Chrome it works for you, but not in Firefox? I wonder if the file_field settings are the same. Does yours differ from mine by much? See attached.

    Yepp, if I use that code it works in Chrome but not Firefox.

    My field settings differ slightly, I have:

    - Is required field: Yes
    - Is field searchable: No
    - Show existing files: Unchecked

    Other than that the field settings are the same as yours.

  • #9 / Apr 11, 2012 10:17am

    Shane Eckert

    7174 posts

    Hi Bjørn,

    I made those changes and that did not have an effect.

    Are you testing the form as Super Admin or a regular user?

    Just trying to find the one thing that we are doing differently.

    Thanks,

  • #10 / Apr 11, 2012 12:42pm

    Bjørn Børresen

    629 posts

    That’s it!!!

    When I’m logged in as admin I get the thumbnail, when I’m logged out I do not. The reason it was working in Chrome and no other browser is because I had an admin session in Chrome.

    Attached is my SafeCracker settings.

  • #11 / Apr 11, 2012 12:58pm

    Shane Eckert

    7174 posts

    Hey Bjørn,

    Okay, that makes sense. SuperAdmin can ALWAYS upload files. So as Super Admin, the file is getting uploaded. As the regular user, it is not.

    So a few questions. Just because I would like to get a feel for your expectations on this and hopefully improve this process.

    Did you create user specifically for using safecracker?

    Does the user that you are logged in as belong to a group that has authority to upload files?

    Are you testing for logged in or logged out?

    Thanks Bjørn - sorry it took so long to get to this point. Now that we are here, I feel like I should have caught this sooner.

    Cheers,

  • #12 / Apr 11, 2012 1:08pm

    Bjørn Børresen

    629 posts

    So a few questions. Just because I would like to get a feel for your expectations on this and hopefully improve this process.

    Did you create user specifically for using safecracker?

    Does the user that you are logged in as belong to a group that has authority to upload files?

    Are you testing for logged in or logged out?

    I’ve allowed guests to post entries. I’m testing as a guest (ie. not logged in). What I’d expect in this case is basically the same functionality for admins and guests - since in this case both are allowed to upload files / post entries using safecracker. Everything works fine in this regard, except that for guests the image is cleared when one gets an error.

    Thanks Bjørn - sorry it took so long to get to this point. Now that we are here, I feel like I should have caught this sooner.

    Don’t be - great detective work here Shane! 😊

    Bjørn

  • #13 / Apr 11, 2012 3:37pm

    Shane Eckert

    7174 posts

    Hey Bjørn,

    I really appreciate the feedback and I will pass this on.

    As it is Guests are not allowed to upload files.

    Is there anything else I can help you with?

    Cheers,

  • #14 / Apr 11, 2012 4:00pm

    Bjørn Børresen

    629 posts

    Actually that part works - Guests are allowed to upload files.

    So there is an inconsistency here - some of the functionality works (the uploading of files) and some do not (the errors).

    Bjørn

  • #15 / Apr 12, 2012 12:58pm

    Shane Eckert

    7174 posts

    Hey Bjørn Børresen,

    On my end this is the test I ran and the results I got.

    As a guest, there is no thumbnail because the image never uploaded. I am watching the directory via FileZilla. No image uploaded means no thumbnail.

    As a logged in user, the thumbnail is present because the file is uploaded. It shows up in the directory as seen via FTP. If I refresh the page, another image gets uploaded and renamed to filename1, filename2, etc. In the FTP directory I see a file for every time I refresh the page.

    You are telling me that your guest is allowed to upload files? Is this a special guest account you created or is this the default “guest” as in a visitor to the site gets thrown into the generic no privileges “Guest” group?

    Please let me know.

    Cheers,

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

ExpressionEngine News!

#eecms, #events, #releases