Closed chongwang87 closed 9 years ago
thanks for the awesome package, i have following error after i upload an image. Image was save under tmpDir but not uploadDir. Any clue where causing the error?
template.html
{{>upload_bootstrap fileTypes='image/*' formData=myFormData}}
template.js helper
template.js
myFormData: function() { return { directoryName: 'images', prefix: this._id, _id: this._id } }
server/init.js
Meteor.startup(function () { UploadServer.init({ tmpDir: '/www/public/tmp', uploadDir: '/www/public/', checkCreateDirectories: true, getDirectory: function(fileInfo, formData) { console.log('\n\ngetDirectory:'); console.log(fileInfo); console.log(formData); return formData; }, getFileName: function(fileInfo, formData) { console.log('\n\getFileName:'); console.log(fileInfo); console.log(formData); return fileInfo; }, finished: function(fileInfo, formData) { console.log('\n\nfinished:'); console.log(fileInfo); console.log(formFields); }, cacheTime: 100 }) });
I20150923-10:05:10.863(8)? I20150923-10:05:10.863(8)? I20150923-10:05:10.863(8)? getDirectory: I20150923-10:05:10.863(8)? poster.jpg I20150923-10:05:10.863(8)? { directoryName: 'images', I20150923-10:05:10.863(8)? prefix: '8HFTt4j4SEcfGjiLJ', I20150923-10:05:10.863(8)? _id: '8HFTt4j4SEcfGjiLJ' } W20150923-10:05:11.158(8)? (STDERR) TypeError: Object #<Object> has no method 'split' W20150923-10:05:11.158(8)? (STDERR) at IncomingForm.<anonymous> (packages/tomi:upload-server/upload_server.js:248:1) W20150923-10:05:11.158(8)? (STDERR) at IncomingForm.emit (events.js:98:17) W20150923-10:05:11.158(8)? (STDERR) at /Users/keep/.meteor/packages/tomi_upload-server/.1.0.3.1b7hz87++os+web.browser+web.cordova/npm/node_modules/formidable/lib/incoming_form.js:228:12 W20150923-10:05:11.158(8)? (STDERR) at WriteStream.<anonymous> (/Users/keep/.meteor/packages/tomi_upload-server/.1.0.3.1b7hz87++os+web.browser+web.cordova/npm/node_modules/formidable/lib/file.js:70:5) W20150923-10:05:11.158(8)? (STDERR) at WriteStream.g (events.js:180:16) W20150923-10:05:11.158(8)? (STDERR) at WriteStream.emit (events.js:117:20) W20150923-10:05:11.158(8)? (STDERR) at finishMaybe (_stream_writable.js:360:12) W20150923-10:05:11.159(8)? (STDERR) at afterWrite (_stream_writable.js:280:5) W20150923-10:05:11.159(8)? (STDERR) at onwrite (_stream_writable.js:270:7) W20150923-10:05:11.159(8)? (STDERR) at WritableState.onwrite (_stream_writable.js:97:5)
getDirectory and getFile function need to rerturn string that describes the relative path to the directory. You are returning an object.
thanks for the awesome package, i have following error after i upload an image. Image was save under tmpDir but not uploadDir. Any clue where causing the error?
template.html
template.js
helperserver/init.js