Giter Club home page Giter Club logo

Comments (2)

josegonzalez avatar josegonzalez commented on August 17, 2024

Can you create a fork with this in it, as well as the relevant tests? Thanks!

from cakephp-upload.

josegonzalez avatar josegonzalez commented on August 17, 2024

A note on why this was implemented my way and not quite the same as you.

Lets say for record 5, I upload a file named bob.jpg. Sometime later, I update the record with a different file, also named bob.jpg.

In your case, code, and if deleteOnUpdate is set to true in mine, the file bob.jpg is added to the deletion cue, the new file is uploaded, and then in the afterSave, the old file, bob.jpg, is deleted right at the end. That means we essentially did not upload a file.

Rather than rework this to use a complicated set of file renames that might potentially fail, I would rather let the developer decide what the tradeoffs be of allowing such a thing to occur. In the future, appending/prepending some hash to the filename, or even allowing the files to be renamed on the fly, may allow for this particular issue to be mitigated. Until then, I decided that implementing this in such a way as to not delete old files by default was the best way.

Please reopen if this is not satisfactory to your work, or if you have a better solution.

from cakephp-upload.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.