tomitrescak / meteor-uploads

MIT License
295 stars 41 forks source link

Dropzone issue #161

Closed ghost closed 9 years ago

ghost commented 9 years ago

Thank you for this amazing package!

I am running into some issue using the dropzone feature. Each time I drop a file, it returns an error. Not sure how to workaround this.

{{> dropzone multiple=true formData=ticketData }}

There is no issue when I am the following code for file uploads

{{> upload_bootstrap multiple=true formData=ticketData }}

ERROR

W20151007-16:17:49.688(8)? (STDERR) /Users/raven/Apps/raven/.meteor/local/build/programs/server/packages/tomi_upload-server.js:413
W20151007-16:17:49.688(8)? (STDERR)     folder.replace(/\./g, '');                                                
W20151007-16:17:49.688(8)? (STDERR)            ^
W20151007-16:17:49.700(8)? (STDERR) TypeError: Cannot call method 'replace' of undefined
W20151007-16:17:49.700(8)? (STDERR)     at IncomingForm.<anonymous> (packages/tomi_upload-server/packages/tomi_upload-server.js:393:1)
W20151007-16:17:49.700(8)? (STDERR)     at IncomingForm.emit (events.js:98:17)
W20151007-16:17:49.701(8)? (STDERR)     at /Users/raven/.meteor/packages/tomi_upload-server/.1.3.1.65qj59++os+web.browser+web.cordova/npm/node_modules/formidable/lib/incoming_form.js:228:12
W20151007-16:17:49.701(8)? (STDERR)     at WriteStream.<anonymous> (/Users/raven/.meteor/packages/tomi_upload-server/.1.3.1.65qj59++os+web.browser+web.cordova/npm/node_modules/formidable/lib/file.js:70:5)
W20151007-16:17:49.701(8)? (STDERR)     at WriteStream.g (events.js:180:16)
W20151007-16:17:49.701(8)? (STDERR)     at WriteStream.emit (events.js:117:20)
W20151007-16:17:49.702(8)? (STDERR)     at finishMaybe (_stream_writable.js:360:12)
W20151007-16:17:49.702(8)? (STDERR)     at afterWrite (_stream_writable.js:280:5)
W20151007-16:17:49.713(8)? (STDERR)     at onwrite (_stream_writable.js:270:7)
W20151007-16:17:49.713(8)? (STDERR)     at WritableState.onwrite (_stream_writable.js:97:5)
ghost commented 9 years ago

It was my mistake but got it working.

Does not work

<template name="ticketPage">
{{> dropzone multiple=true formData=ticketData }}
</template>

Solution

<template name="ticketPage">
{{> ticketDropZone }}
</template>

<template name="ticketDropZone">
{{> dropzone multiple=true formData=ticketData }}
</template>

Template.ticketDropZone.helpers({
  ticketData: function() {
    return {
      directoryName: "ticket_" + this._id,
      prefix: Meteor.userId(),
      ticketId: this._id,
    }
  }
});