meteor-autoform-file icon indicating copy to clipboard operation
meteor-autoform-file copied to clipboard

File ID reference is not being saved in related collection

Open brylie opened this issue 9 years ago • 6 comments

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?

brylie avatar Jan 29 '16 12:01 brylie

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.

Jocoder avatar Feb 04 '16 02:02 Jocoder

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

brylie avatar Feb 04 '16 08:02 brylie

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.

maka-io avatar Mar 01 '16 02:03 maka-io

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

brylie avatar Mar 01 '16 07:03 brylie

@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.

maka-io avatar Mar 01 '16 11:03 maka-io

Ah, good work. :-)

brylie avatar Mar 01 '16 11:03 brylie