meteor-autoform-file
meteor-autoform-file copied to clipboard
File ID reference is not being saved in related collection
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?
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.
OK, I will rename this to indicate that it may be a bug.
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.
FWIW, we deprecated this package in our project in favor of cfs:autoform.
@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.
Ah, good work. :-)