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

File ID reference is not being saved in related collection #89

Open
brylie opened this issue Jan 29, 2016 · 6 comments
Open

File ID reference is not being saved in related collection #89

brylie opened this issue Jan 29, 2016 · 6 comments

Comments

@brylie
Copy link

brylie commented Jan 29, 2016

We have a collection, named Branding, with a file upload field defined as such:

projectLogoId: {
    type: String,
    label: 'Project logo',
    optional: true,
    autoform: {
      afFieldInput: {
        type: 'fileUpload',
        collection: 'ProjectLogo'
      }
    }
  },

We would like to access the file ID from within the Branding collection, but it is not saved in the projectLogo field. How can we save the file ID in the projectLogo field, when we use the fileUpload widget?

@Jocoder
Copy link

Jocoder commented Feb 4, 2016

I am having this same issue. It must be a recent bug because this is basic functionality of this package. It should be saving the _id of the uploaded file in the FS.Collection as the value of the field from the schema. That's how I've used it in the past. But it hasn't been showing up in the modifier of any updates I have it set in, even though I can see the new value is getting set on the input when I upload a file.

My schema is set up very similar to yours so let me know if you found out it was just some user error.

@brylie
Copy link
Author

brylie commented Feb 4, 2016

OK, I will rename this to indicate that it may be a bug.

@brylie brylie changed the title How to store file ID from uploaded file in related collection? File ID reference is not being saved in related collection Feb 4, 2016
@maka-io
Copy link

maka-io commented Mar 1, 2016

I'm having this issue too. When I check mongo after issuing a file upload, the _id isn't reflected in the corresponding collection.

It did work recently, but as of now it's still broken.

@brylie
Copy link
Author

brylie commented Mar 1, 2016

FWIW, we deprecated this package in our project in favor of cfs:autoform.

@maka-io
Copy link

maka-io commented Mar 1, 2016

@brylie, I would switch our project as well if cfs:autoform supported update methods.

I was able to fix (possibly my version of) this issue by adding the 'name' attribute to the input element that is generated after uploading. You need to issue a submit, but it did the trick.

I opened PR #98 that shows the change.

@brylie
Copy link
Author

brylie commented Mar 1, 2016

Ah, good work. :-)

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

No branches or pull requests

3 participants