Giter Site home page Giter Site logo

Comments (6)

mdxiaohu avatar mdxiaohu commented on September 22, 2024

image
I use the onBeforeFileAdded method to observe data changes.
When data A uploads file B, there is a piece of data in files.
{key: fileA}
When data B uploads file B, under the observation of the debugger, the initial data for files is still
{key: fileA}
Later on, it became
{key: fileB}
Because the file IDs are the same

from uppy.

mdxiaohu avatar mdxiaohu commented on September 22, 2024

I'm not sure if it's possible to directly modify the value of currentFile.id in the onBeforeFileAdded method to avoid ID conflicts.
However, considering that I am using TUS for uploading large files, which may affect the breakpoint continuation function, I did not modify the ID value here.

for example: onBeforeFileAdded: (currentFile, files) => {currentFile.id = newid}

from uppy.

mdxiaohu avatar mdxiaohu commented on September 22, 2024

At present, I am directly modifying the value of ID in the onBeforeFileAdded method, which does not seem to affect subsequent functionality. I will use this method for now to solve the problem.

from uppy.

Murderlon avatar Murderlon commented on September 22, 2024

If I understand correctly, you want the same file to be uploaded to two different destinations?

from uppy.

mdxiaohu avatar mdxiaohu commented on September 22, 2024

If I understand correctly, you want the same file to be uploaded to two different destinations?

Thank you for your reply. You can understand it this way.
The main issue is duplicate file IDs.
My current solution is to reassign the generated file ID value before uploading using the onBeforeFileAdded method.

Currently, there is no issue with duplicate IDs as mentioned above.
Because I used the following code.

onBeforeFileAdded: (currentFile, files) => {
    currentFile.id = `${currentFile.id}-${currentFile.source}`
}

I modified the value of the generated ID to avoid replacing the previous file with the later one when uploading the same file.

from uppy.

Murderlon avatar Murderlon commented on September 22, 2024

I think this problem should be solved on the backend. Depending on which tus server you use, there are hooks/events you could use to move the file to a different storage location. This is not something we support on the client, although you could hack it in there as you've tried.

Can you try to do this with your tus server?

from uppy.

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.