When trying to upload multiple sizes, i get an Unexpected object in htmljs error
Opened this issue · 1 comments
THPubs commented
I'm trying to upload multiple images like this :
photos: {
type: [Object],
label: 'Photo ( Photo should have a width of 340px and a height of 190px )',
autoform: {
type: 'slingshotFileUpload',
removeLabel: 'Remove', // (optional, defaults to "Remove")
afFormGroup: { // (optional)
label: false
},
afFieldInput: {
thumbnail: 'thumb',
slingshotdirective: {
thumb: {
directive: "achievementPhotoThumbnailUpload",
onBeforeUpload: function (file, callback) {
// Create a mobile 640x640 size version.
Resizer.resize(file, {
width: 340,
height: 190,
cropSquare: true
}, function (err, file) {
if (err) {
console.error(err);
}
callback(file);
});
}
},
original: 'achievementPhotoUpload'
}
}
}
},
'photos.$.key': {
type: String
},
'photos.$.filename': {
type: String
},
'photos.$.src': {
type: String
},
'photos.$.directive': {
type: String
},
But when I navigate to the form, it gives me a blank page and shows this error in the console :
Exception in defer callback: Error: Unexpected object in htmljs in toText: [object Object]
at HTML.ToTextVisitor.def.visitObject (http://localhost:3000/packages/htmljs.js?hash=6c22e7d941777b671e2b03be4fe909e9f276f9ea:292:11)
at HTML.Visitor.def.visit (http://localhost:3000/packages/htmljs.js?hash=6c22e7d941777b671e2b03be4fe909e9f276f9ea:113:31)
at Object.HTML.toText (http://localhost:3000/packages/htmljs.js?hash=6c22e7d941777b671e2b03be4fe909e9f276f9ea:668:18)
at Object.Blaze._toText (http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:2411:15)
at updateAttributes (http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:1524:39)
at http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:1875:20
at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:3683:12)
at http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:1873:29
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:2214:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?hash=7abafff7bd98fa1fc0a6478fb26dd08cdd3fe7ee:1872:18)
I checked and re-checked the autoform code. Also pasted your exact code... But still the issue is there!
sjkdev21 commented
Having the same issue