Duplicate filenames overwriting each other in SAEF

ryanbattles's Avatar

ryanbattles

02 Jul, 2010 01:30 AM via web

I use nGen File to handle the profile photo upload tool on Director-ee.com. It has worked great for the most part, but every once and a while people are uploading a photo with the same name and the newer one overwrites the other. The result is that some members who have saved their profile picture as a common name (avatar.jpg, etc.) end up sharing the same profile picture with another member. An example is the two profiles attached.

Is there a way to give each upload a unique string name? Have you seen this issue before?

  1. Support Staff 2 Posted by Fred Boyle on 23 Jul, 2010 03:23 PM

    Fred Boyle's Avatar

    Ryan, ngen file by default will not overwrite files and appends a number to files with the same filename. So if avatar.jpg exists the next avatar.jpg would actually be saved as avatar-1.jpg.

    Not sure if this is occurring because of the SAEF situation or other reason. Which version of ngen file are you using? What platform are you hosted on? In the CP do the entries show different files or the same file? If you check in the upload location do you see additional files with the numeric suffixes?

  2. 3 Posted by ryanbattles on 23 Jul, 2010 04:46 PM

    ryanbattles's Avatar

    Fred,

    Thanks for your response. We are running EE 1.6.9 with nGen File Field
    1.0.1 hosted with EngineHosting. For the most part, the items are working
    as they should, with numbers appending to file names upon duplicate
    entries. However, this isn't always the case, every once and a while we get
    some duplicates overwriting each other. Might be related to the SAEF.

    -Ryan Battles
     [image: Jovia Web Studio] <http://joviawebstudio.com>
    *Ryan Battles* : Project Manager at Jovia Web Studio<http://joviawebstudio.com>
    email ***@joviawebstudio.com
    office 155 Mill Street, Columbus, OH 43230
     On Fri, Jul 23, 2010 at 11:27 AM, Fred Boyle <
    ***@tenderapp.com<tender%***@tenderapp.com>
    > wrote:

  3. 4 Posted by Peter Baker on 13 Aug, 2010 03:19 PM

    Peter Baker's Avatar

    We're having the same problem (EE 1.6.9, File Field 1.0.1) and I think SAEF might be the problem. If a file was uploaded through a SAEF, uploading a similarly named file in the control panel does not cause the -1 to be added to the filename, and the upload breaks.

  4. Support Staff 5 Posted by Fred Boyle on 16 Aug, 2010 03:44 PM

    Fred Boyle's Avatar

    Odd that SAEF should be the trigger for this issue. The same functions are used in SAEF + CP. Can either of you confirm that the issue only occurs when upload via SAEF?

  5. 6 Posted by ryanbattles on 18 Aug, 2010 08:33 PM

    ryanbattles's Avatar

    Fred,

    Thanks for replying to this issue. I have not been able to replicate this
    issue in a controlled environment, as it usually works as it should.
    However, it is only on occasion that the incremental digit isn't added to
    the file name upon duplicate uploads.
    -Ryan Battles

      [image: Jovia Web Studio] <http://joviawebstudio.com/>
    *Ryan Battles* : Lead Programmer at Jovia Web Studio<http://joviawebstudio.com/>
    email ***@joviawebstudio.com
    office 155 Mill Street, Columbus, OH 43230
    work (614) 423-9326 cell (614) 226.9949

    On Mon, Aug 16, 2010 at 11:46 AM, Fred Boyle <
    ***@tenderapp.com<tender%***@tenderapp.com>
    > wrote:

  6. Support Staff 7 Posted by Fred Boyle on 02 Sep, 2010 05:23 PM

    Fred Boyle's Avatar

    Ryan, it could be on occasion two files trying to be written in near succession at which point neither of the two browsers uploading would be aware of the file that has not yet been written. That's the only situation I could think of.

    If you ever find precise steps to reliably reproduce the problem please let me know. Until then I'll close this issue.

  7. Fred Boyle closed this discussion on 02 Sep, 2010 05:23 PM.

  8. ryanbattles re-opened this discussion on 02 Sep, 2010 06:27 PM

  9. 8 Posted by ryanbattles on 02 Sep, 2010 06:27 PM

    ryanbattles's Avatar

    Sounds good Fred, thanks for your help.
    -Ryan Battles

      [image: Jovia Web Studio] <http://joviawebstudio.com/>
    *Ryan Battles* : Lead Programmer at Jovia Web Studio<http://joviawebstudio.com/>
    email ***@joviawebstudio.com
    office 155 Mill Street, Columbus, OH 43230
    work (614) 423-9326 cell (614) 226.9949

    On Thu, Sep 2, 2010 at 1:25 PM, Fred Boyle <
    ***@tenderapp.com<tender%***@tenderapp.com>
    > wrote:

  10. 9 Posted by Daniel Boswell on 28 Sep, 2010 02:42 PM

    Daniel Boswell's Avatar

    Ryan,

    I also use EE 1.6.9. Would you be willing to share how you use the nGen File to upload photos for your members? Due to the fact that the default member photo upload uses such generic file names like photo_1.jpg, I need a way to have unique file names for the members area. Too bad we can't just use nGen File as a custom member field.

    Thanks,

    Daniel Boswell

  11. 10 Posted by ryanbattles on 28 Sep, 2010 08:58 PM

    ryanbattles's Avatar

    Daniel,

    I used entries for each member on Director-ee, so using nGen File was as
    simple as typing the field name in the stand alone edit form. If we would
    have utilized member profile fields, this would have been much more
    difficult if not impossible.

    You may be able to create a hybrid approach of both member profile fields
    and a weblog named "profile" by using some logic like the following:

    If the member has an entry in the profile weblog, provide a stand alone edit
    field.
    If the member doesn't have an entry, provide a stand alone entry field.

    Just use the parameter author_id="CURRENT_USER" when calling the weblog
    entries tag for the profile weblog. If no_results, embed a stand alone
    entry form.

    -Ryan Battles
    *Ryan Battles* : Lead Programmer at Jovia Web
    Studio<http://joviawebstudio.com/>
    email ***@joviawebstudio.com office 155 Mill Street, Columbus, OH
    43230 work (614) 423-9326 cell (614) 226-9949

    On Tue, Sep 28, 2010 at 10:44 AM, Daniel Boswell <
    ***@tenderapp.com<tender%***@tenderapp.com>
    > wrote:

  12. Support Staff 11 Posted by Fred Boyle on 29 Sep, 2010 02:09 PM

    Fred Boyle's Avatar

    Daniel + Ryan, great to see the continuing conversation however if you could take it offline via email or other method I'd appreciate it. Just helps to keep the trouble tickets clean since this isn't meant to be a forum.

    Thanks for using nGen file!

  13. Fred Boyle closed this discussion on 29 Sep, 2010 02:09 PM.

Comments are currently closed for this discussion. You can start a new one.