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

Upload not working. Console shows warning. #49

Closed
rizkysyazuli opened this issue Jul 14, 2015 · 9 comments
Closed

Upload not working. Console shows warning. #49

rizkysyazuli opened this issue Jul 14, 2015 · 9 comments

Comments

@rizkysyazuli
Copy link

I'm getting this warning in the console when uploading a file. i'm using it inside the yogiben:admin dashboard.

http-call-client.js:101 - The provided value 'undefined' is not a valid enum value of interface XMLHttpRequestResponseType.

Any ideas? Edit: added my code and some comments below.

lib/collections/images.js

Images = new FS.Collection('images', {
    stores: [new FS.Store.FileSystem('images', {path: '~/uploads'})]
});

if (Meteor.isServer) {
    Images.allow({
        insert: function (userId, doc) {
            return !! userId;
        },

        update: function (userId, doc, fieldNames, modifier) {
            return !! userId;
        },

        remove: function (userId, doc) {
            return !! userId;
        }
    });
}

server/publish.js

Meteor.publish('images', function () {
    return Images.find();
});

lib/collections/posts.js

Posts = new Mongo.Collection('posts');
Posts.attachSchema(new SimpleSchema({
    ...
    pictures: {
        type: [String],
        label: 'Choose file'
    },
    'pictures.$': {
        autoform: {
            afFieldInput: {
                type: 'fileUpload',
                collection: 'Images'
            }
        }
    }
}));

I followed the instructions for the multiple images. But I skipped the subscription and the auto-form part. since i assume that's handled by the yogiben:admin package, cmiiw.

UPDATE:

I've added the "Images" collection to the admin configuration but it throws an error.

lib/config.js

AdminConfig = {
    name: 'Project Name',
    adminEmails: ['admin@email.com'],

    collections: {
        Posts: {
            icon: 'file-text-o'
        },
        // added this line
        Images: {
            icon: 'file-image-o'
        }
    }
};

With this message in the console:

W20150718-23:27:28.036(7)? (STDERR) /Users/rizky/.meteor/packages/meteor-tool/.1.1.3.8ctqri++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150718-23:27:28.036(7)? (STDERR)                         throw(ex);

W20150718-23:27:28.037(7)? (STDERR)                               ^

W20150718-23:27:28.085(7)? (STDERR) Error: Tabular.Table options must specify collection

W20150718-23:27:28.085(7)? (STDERR)     at new Tabular.Table (packages/aldeed:tabular/common.js:20:1)
W20150718-23:27:28.086(7)? (STDERR)     at packages/yogiben:admin/lib/both/startup.coffee:101:27
W20150718-23:27:28.086(7)? (STDERR)     at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
W20150718-23:27:28.086(7)? (STDERR)     at adminCreateTables (packages/yogiben:admin/lib/both/startup.coffee:77:4)
W20150718-23:27:28.086(7)? (STDERR)     at __coffeescriptShare (packages/yogiben:admin/lib/both/startup.coffee:185:2)
W20150718-23:27:28.086(7)? (STDERR)     at /Users/rizky/Sites/apta/helpyourbody/app/.meteor/local/build/programs/server/boot.js:229:5

=> Exited with code: 8
@kristijanbambir
Copy link

I can confirm this.

@rizkysyazuli
Copy link
Author

updated the ticket with code examples.

@fellz
Copy link

fellz commented Jul 21, 2015

The same issue here, uploading is not working. When i try to upload image i get the same error.
I investigated error in Developer Tools and there is TypeError in this line:
xhr.responseType = options.responseType;
options doesn't have responseType property so options.responseType = undefined and xhr.responseType = undefined
In my case options is Object with only 3 fields

  • content
  • headers
  • params

@oiramcro
Copy link

+1

@bjimdar
Copy link

bjimdar commented Jul 30, 2015

I'm having the same problem and seeing the same error message, however for the me the image is being uploaded and saved (to GridFS, in my case), but then the error happens when reading back the image to display. The question in my mind at this moment is if this is a bug in this this package at all, or something in CFS packages.

A second bug, or a side-effect of this one is that previously uploaded images no longer display in the autoform.

I figured out you can do a FS.debug=true to turn on CFS console debugging messages. Here's my console when trying to upload image:

image

Note: the "app.js" console lines are from my code telling me that the user's profile record is being updated with the new image reference.

@tmsss
Copy link

tmsss commented Jul 30, 2015

I had the same issue, in my case I was subscribing the images/files collection in the wrong route, it was solved once I've subscribed it in route of the autoform, something like this:

Router.route('/items/create', {
waitOn: function() {
return [Meteor.subscribe('images')];
},
name: 'CreateItem',
controller: 'ItemsController',
action: 'create',
where: 'client'
});

I hope it helps.

@genyded
Copy link

genyded commented Aug 23, 2015

This would seem to be the same root issue as https://github.com/aldeed/meteor-http-extras/pull/8/files and the same fix needed only in http-call-client.js

@Maay
Copy link

Maay commented Oct 8, 2015

+1

@mpowaga
Copy link
Collaborator

mpowaga commented Jan 12, 2016

This is "just" warning and it's not part of meteor-admin code.

@mpowaga mpowaga closed this as completed Jan 12, 2016
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

9 participants