{"action":"created","issue":{"url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/92","repository_url":"https://api.github.com/repos/vsivsi/meteor-file-collection","labels_url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/92/labels{/name}","comments_url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/92/comments","events_url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/92/events","html_url":"https://github.com/vsivsi/meteor-file-collection/issues/92","id":140917663,"number":92,"title":"Same md5 after insert","user":{"login":"crapthings","id":1147704,"avatar_url":"https://avatars.githubusercontent.com/u/1147704?v=3","gravatar_id":"","url":"https://api.github.com/users/crapthings","html_url":"https://github.com/crapthings","followers_url":"https://api.github.com/users/crapthings/followers","following_url":"https://api.github.com/users/crapthings/following{/other_user}","gists_url":"https://api.github.com/users/crapthings/gists{/gist_id}","starred_url":"https://api.github.com/users/crapthings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crapthings/subscriptions","organizations_url":"https://api.github.com/users/crapthings/orgs","repos_url":"https://api.github.com/users/crapthings/repos","events_url":"https://api.github.com/users/crapthings/events{/privacy}","received_events_url":"https://api.github.com/users/crapthings/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vsivsi/meteor-file-collection/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-15T09:20:24Z","updated_at":"2016-03-15T17:52:25Z","closed_at":null,"body":"code\r\n\r\n\tmyFiles = new FileCollection('myFiles', {\r\n\t\tresumable: true, // Enable built-in resumable.js chunked upload support\r\n\t\thttp: [ // Define HTTP route\r\n\t\t\t{\r\n\t\t\t\tmethod: 'get', // Enable a GET endpoint\r\n\t\t\t\tpath: '/:md5', // this will be at route \"/gridfs/myFiles/:md5\"\r\n\t\t\t\tlookup: function (params, query) { // uses express style url params\r\n\t\t\t\t\tconsole.log(params, query)\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tmd5: params.md5\r\n\t\t\t\t\t}; // a query mapping url to myFiles\r\n\t\t\t\t}\r\n\t\t\t}, {\r\n\t\t\t\tmethod: 'put', // Enable a PUT endpoint\r\n\t\t\t\tpath: '/:md5', // this will be at route \"/gridfs/myFiles/:md5\"\r\n\t\t\t\tlookup: function (params, query) { // uses express style url params\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tmd5: params.md5\r\n\t\t\t\t\t}; // a query mapping url to myFiles\r\n\t\t\t\t}\r\n\t\t\t}, {\r\n\t\t\t\tmethod: 'options', // Enable an OPTIONS endpoint (for CORS)\r\n\t\t\t\tpath: '/:md5', // this will be at route \"/gridfs/myFiles/:md5\"\r\n\t\t\t\tlookup: function (params, query) { // uses express style url params\r\n\t\t\t\t\treturn {\r\n\t\t\t\t\t\tmd5: params.md5\r\n\t\t\t\t\t}; // a query mapping url to myFiles\r\n\t\t\t\t},\r\n\t\t\t\thandler: function (req, res, next) { // Custom express.js handler for OPTIONS\r\n\t\t\t\t\tconsole.log(req, res)\r\n\t\t\t\t\tres.writeHead(200, {\r\n\t\t\t\t\t\t'Content-Type': 'text/plain',\r\n\t\t\t\t\t\t'Access-Control-Allow-Origin': '*',\r\n\t\t\t\t\t\t'Access-Control-Allow-Methods': 'GET, PUT'\r\n\t\t\t\t\t});\r\n\t\t\t\t\tres.end();\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t]\r\n\t});\r\n\r\n\tif (Meteor.isClient) {\r\n\r\n\r\n\t\tTemplate.filepicker.events({\r\n\t\t\t'change input': function (e, t) {\r\n\t\t\t\tconsole.log(1, 'your file', e.currentTarget.files)\r\n\t\t\t\tvar file = e.currentTarget.files[0]\r\n\r\n\t\t\t\tmyFiles.insert({\r\n\t\t\t\t\t_id: new Meteor.Collection.ObjectID(),\r\n\t\t\t\t\tfilename: file.name,\r\n\t\t\t\t\tcontentType: file.type\r\n\t\t\t\t}, function () {\r\n\t\t\t\t\tmyFiles.resumable.upload()\r\n\t\t\t\t})\r\n\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t}\r\n\r\n\tif (Meteor.isServer) {\r\n\r\n\t\tmyFiles.allow({\r\n\t\t\tinsert: function () {\r\n\t\t\t\treturn true\r\n\t\t\t},\r\n\r\n\t\t\twrite: function () {\r\n\t\t\t\treturn true\r\n\t\t\t},\r\n\r\n\t\t\tremove: function () {\r\n\t\t\t\treturn true\r\n\t\t\t},\r\n\t\t\tread: function () {\r\n\t\t\t\treturn true\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t}\r\n"},"comment":{"url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/comments/196946533","html_url":"https://github.com/vsivsi/meteor-file-collection/issues/92#issuecomment-196946533","issue_url":"https://api.github.com/repos/vsivsi/meteor-file-collection/issues/92","id":196946533,"user":{"login":"vsivsi","id":428642,"avatar_url":"https://avatars.githubusercontent.com/u/428642?v=3","gravatar_id":"","url":"https://api.github.com/users/vsivsi","html_url":"https://github.com/vsivsi","followers_url":"https://api.github.com/users/vsivsi/followers","following_url":"https://api.github.com/users/vsivsi/following{/other_user}","gists_url":"https://api.github.com/users/vsivsi/gists{/gist_id}","starred_url":"https://api.github.com/users/vsivsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vsivsi/subscriptions","organizations_url":"https://api.github.com/users/vsivsi/orgs","repos_url":"https://api.github.com/users/vsivsi/repos","events_url":"https://api.github.com/users/vsivsi/events{/privacy}","received_events_url":"https://api.github.com/users/vsivsi/received_events","type":"User","site_admin":false},"created_at":"2016-03-15T17:52:25Z","updated_at":"2016-03-15T17:52:25Z","body":"If you want to see a working example, I suggest the sample app:  https://github.com/vsivsi/meteor-file-sample-app"}}