Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible to link an existing file to an entity #841

Closed
Adzouz opened this issue Mar 25, 2018 · 8 comments
Closed

It should be possible to link an existing file to an entity #841

Adzouz opened this issue Mar 25, 2018 · 8 comments
Assignees

Comments

@Adzouz
Copy link

Adzouz commented Mar 25, 2018

Node.js version:
8.9.3
npm version:
5.5.1
Strapi version:
3.0.0-alpha.11.1
Operating system:
MacOS 10.13.3

Do you want to request a feature or report a bug?
feature

What is the current behavior?
If we want to attach an uploaded file to an entity, it's only possible in one way : first step is to create the entity and the second is to upload the file and pass the created entity refId. But if we want to upload the file first and attach it to a new entity in that order, I can't do it.

If the current behavior is a bug, please provide the steps to reproduce the problem
It's not a bug I think but to reproduce it, I've tried to upload my file first then after I tried to create my entity and in the file field, I tried to put the file id but it didn't work.

What is the expected behavior?
It should be possible to pass the id of the file in the field we create the new entry of the entity.

@lauriejim lauriejim self-assigned this Mar 26, 2018
@lauriejim lauriejim added issue: feature request Issue suggesting a new feature severity: medium If it breaks the basic use of the product but can be worked around labels Mar 26, 2018
@lauriejim lauriejim assigned Aurelsicoko and unassigned lauriejim Mar 27, 2018
@lauriejim lauriejim added issue: help wanted and removed severity: medium If it breaks the basic use of the product but can be worked around issue: feature request Issue suggesting a new feature labels Mar 27, 2018
@lauriejim
Copy link
Contributor

@Aurelsicoko told me it's possible. I let him answer you.

@Aurelsicoko
Copy link
Member

Aurelsicoko commented Mar 30, 2018

This behaviour will be handled by the Media Library plugin. It wasn't the goal of the Upload plugin to manage the links between entities and files. However, we anticipated it, that's all we did.

Edited: I still think it's already possible. If you pass the ID of the file when you update an entity, I'm almost sure both will be associated.

@lauriejim
Copy link
Contributor

@TheWebsDoor Have you update about this point ?

@Adzouz
Copy link
Author

Adzouz commented Apr 10, 2018

I didn't try to reproduce it since the last time, I'll check it tonight and I'll let you know !

@fodkastir
Copy link
Contributor

fodkastir commented Sep 17, 2019

@TheWebsDoor Have you figured out how to link an existing file to an entity? I have the same question but could not find the answer.

@Adzouz
Copy link
Author

Adzouz commented Sep 18, 2019

@fodkastir I have to admit that it's been a while and I don't really remember if I came up with something. @lauriejim have you done something about this since last time? Let me know if you want me to investigate a bit more!

@lauriejim
Copy link
Contributor

This feature will be available in this feature card - https://portal.productboard.com/strapi/1-public-roadmap/c/28-media-library-with-edit-crop-resize-capabilities
For now, you can only Upload file related to an entry. That is the reason why the feature name that is available is named Upload

@francescofact
Copy link

I tried to upload the file to the entity, but i can't get it on the entity. I find it in the Media Library but the field "Avatar" of the entity is empty.
await uploadFiles(me, files, { model: strapi.models.agenzie })
this is my code, where "me" is the ID of the entity in the table agenzie and "files" is obtained by parseMultipartData(ctx)
Am i missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants